/*
 * Author : Michael Bosworth 2006
 *
 * Note : This class is dependant on : mootools
 * 
 * These files must be included with this script to function.
*/

var nutritionLayer = null;

nutritionLayer = $("#nutrition");
var imgContain = $("#recipeimg");
if($("#recipeimg").length > 0){
    if(imgContain.children().length == 1 && imgContain.children()[0].nodeType == 3){
        imgContain.css('display',"none");
    }
}

	
function go(box)
{
	if(box != null) {
        var destination = box.options[box.selectedIndex].value;
    }
    if(destination){
        var isPremium = destination.indexOf("xml");
        if(isPremium != -1){
            location.href = "/recipes/collectionDisplay.jsp?collectionId=" + destination;
        }
        else{
            location.href = destination;
        }
    }
}

/* Details Page */
function showNutrition(){

    if(nutritionLayer != null){
        document.getElementById('nutrition').style.display = 'block';
    }
    else{
        window.location.href = "/common/profile/regStep1.jsp";
    }

}

/* Handles Print Views for Recipe Details Print Page */
function printView(size){
    switch(size){
        case "fullPage":
            $("#detail").css('width',"485px");
            $("#detailcol").css({'float':"left",'width':'275px'});
            $("#recipeimg").css({'float':"right",'margin-right':"0px"});
            $("#pnutrition").css({'float':"left",'width':'200px'});
        break;
        case "3x5":
            $("#detail").css('width',"288px");
            $("#detailcol").css({'float':"none",width:'288px'});
            $("#recipeimg").css({'float':'none','margin-right':'88px'});
            $("#pnutrition").css({'float':'none',width:'288px'});
        break;
        case "4x6":
            $("#detail").css('width',"384px");
            $("#detailcol").css({'float':"none",'width':'384px'});
            $("#recipeimg").css({'float':"none",'margin-right':'184px'});
            $("#pnutrition").css({'float': "none",'width':'384px'});
        break;
        default:
            $("#detail").css('width',"485px");
            $("#detailcol").css({'float':"left",'width':'275px'});
            $("#recipeimg").css({'float':"right",'margin-right':'0px'});
            $("#pnutrition").css({'float':"left",'width':'200px'});
        break;
    }
}
