/** 
 * Functions for opening new windows.
 *
 * $Id: popup.js,v 1.4 2006/11/30 17:32:41 dangelillo Exp $
 */

var popWin = null; 
var popFlashWin = null;
var bigWin = null;


function sayHello(world){
	alert('hello ' + world);	
}
function getPopUp(image_source, image_width, image_height) {
	image_width = parseInt(image_width) + 20;
	popWin = window.open('/media/viewer.html?image=' + escape(image_source),'popup','width='+image_width +',height='+image_height+',directories=no,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes');
	
}


function show_ad(ad) {
	popWin = window.open('/news/viewer.html?PreventCache=9999&image=' + escape('/images/news/ads/full/') + ad,'popup','width=410,height=530,directories=no,location=no,menubar=no,scrollbars=no,status=yes,toolbar=no,resizable=yes');
}

/** 
 * Open a custom pop-up window with the provided 'src' (page URL), 
 * 'height' and 'width'.
 */
function popUp (src, width, height)
{
    popWin = window.open(src,'popup','width='+width+',height='+height+',directories=no,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes');
    popWin.focus();
}

/** 
 * If you need to popUp a popUp inside of a popUp
 */
function popUp2 (src, width, height)
{
    popWin2 = window.open(src,'popup2','width='+width+',height='+height+',directories=no,location=no,menubar=no,scrollbars=yes,status=yes,toolbar=no,resizable=yes');
    popWin2.focus();
}

/** 
 * Same as popUp, but without scrollbars, for the flash popups. 
 */

function popUp_flash (src, width, height)
{
    popFlashWin = window.open(src,'popup','width='+width+',height='+height+',status=yes,resizable=no');
    popFlashWin.focus();
}

/** 
 * Open a sized pop-up window with the provided 'src' (page URL).
 */
function sizedPopUp (src)
{
    popUp(src, 688, 450);
}

/** 
 * Corresponding with popUp2
 */
function sizedPopUp2 (src)
{
    popUp2(src, 688, 450);
}

/** 
 * Open a sized full-size browser window, as a standards-compliant 
 * replacement to target="_blank" anchors.
 */
function newWin (src)
{ 
    bigWin = window.open(src);
    bigWin.focus();
}

/** 
 * Display a confirmation message, and open a new browser window with a new site
 * upon approval of the message.  If user selects "cancel", do nothing.
 */
function newWinConfirm (src, message)
{ 
    if (confirm(message)) {
        bigWin = window.open(src);
        bigWin.focus();
        return false;  // so as not to let the main link do anything.
    } else {
        return false;
    }
}


/** 
 * Open specified URL in parent window (if available) and close the current
 * window.  If parent can't be found, the URL is opened in the current window.
 */
function goToParentWindow (url)
{
    if (window.opener) {
        window.opener.location = url;
        window.close();
    } else {
        location = url;
    }
}





function gotoPrintAllRecipes (src) {
	//alert(src);
	bigWin = window.open(src,'popup','width=820,height=600,directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes');
    bigWin.focus();
}




function gotoPrintRecipe (src) {
	bigWin = window.open(src,'popup','width=820,height=600,directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes');
    bigWin.focus();
}

//ADDED BY SEAN
function gotoprintRecipeId (id) {
	bigWin = window.open('/tonys_world/recipes/print_recipe/site_recipe_print.php?recipe_id=' + id,'popup','width=600,height=550,directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=no');
    bigWin.focus();
}





