/*
*	Rachael Ray
*	Contains utility / interface functions for Rachael Ray Show Season 2
*	
*	Requires
*            - jQuery library (http://www.jquery.com),
*	
*	Marcos Abreu (marcos@trapeze.com) - September 28, 2007
*/

if (typeof trapeze == 'undefined') trapeze = new Object();

trapeze.RachaelRay.Toolbox = {
	
	set_options : function() {
		if ($(".toolbox .print").size() > 0) {
			$(".toolbox .print").click(function(){
				trapeze.RachaelRay.Toolbox.popup_window('print/', 'menu', '660', '480');
				return false;
			});
		}
	},
	
	popup_window : function(url, type, strWidth, strHeight) {
		trapeze.RachaelRay.Toolbox.close_if_open();
		type = type.toLowerCase();
		if (type == "fullscreen"){
			strWidth = screen.availWidth;
			strHeight = screen.availHeight;
		}
		var tools="";
		if (type == "standard") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
		if (type == "menu") tools = "resizable,toolbar=no,location=no,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",left=0,top=0";
		if (type == "console" || type == "fullscreen") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
		newWindow = window.open(url, 'newWin', tools);
		newWindow.focus();
	},

	close_if_open : function() {
		if ((typeof newWindow != 'undefined') && (newWindow != null)) {
			if(!newWindow.closed) newWindow.close();
		}
	}
};

$(function() {
	trapeze.RachaelRay.Toolbox.set_options();
});