﻿// JScript File

function Ving2(tCODE) {
    zwin=window.open("/ViewIng.aspx?c="+tCODE,"Ingredients","location=0,status=0,scrollbars=1,resizable=1,width=278,height=400");
	zwin.focus(); //AD 05/09/07
}

function Ving( tMODE, tCODE) {
    if( tMODE==0 ) {
		document.getElementById('vrpMsg').style.border="";
		document.getElementById('vrpMsg').style.width="1px";
		document.getElementById('vrpMsg').style.height="1px";
		document.getElementById('vrpMsg').innerHTML= " ";
		return;
    }
	oPage = "";
	msgWidth=400;
	msgHeight=450;
	msgData = "<img src='/prodimgs/VRP"+tCODE+".jpg' alt='' title='Ingredients' />";
    // Show centered on screen.
    document.getElementById('vrpMsg').style.top="5px";
    document.getElementById('vrpMsg').style.left=(GetWidth()/2)-(msgWidth/2)+"px";
    //
    // Show just left of cursor.
    var sTOP = 0;
    var sDOWN = 0;
    var sHEIGHT = 0;
    if (document.documentElement && !document.documentElement.scrollTop) {
        sTOP=document.documentElement.scrollTop;
        sHEIGHT=document.documentElement.clientHeight;
    }
    else if (document.documentElement && document.documentElement.scrollTop) {
        sTOP=document.documentElement.scrollTop;
        sHEIGHT=document.documentElement.clientHeight;
    }
    else if (document.body && document.body.scrollTop) {
        sTOP=document.body.scrollTop;
        sHEIGHT=document.body.clientHeight;
    }
    sDOWN=sTOP;
    var boxLeft = 0;
    var boxTop = 0;
    boxLeft= (  mouseX -(msgWidth+40)  );
    //        
    if(!document.all) {   // FIREFOX
        boxTop= (  mouseY - (msgHeight/2) );
    } else {                  // I.E.
        mouseY2=5+sTOP;
        boxTop= (  mouseY2 - (msgHeight/2) );
    }
    xtop=Number(boxTop);
    xheight=Number(msgHeight);
    xvalue=xtop+xheight;
    ytop=Number(sTOP);
    yheight=Number(sHEIGHT);
    yvalue=ytop+yheight;
    zvalue=yvalue-xheight;
    if( xtop < ytop ) {
    boxTop=ytop+40;
    } else {
        if( xvalue > yvalue ) {
            boxTop = zvalue-40;
        }
    }
	//document.getElementById('ihaMsg').style.left=Trim(boxLeft)+"px";
	document.getElementById('vrpMsg').style.top=Trim(boxTop)+"px";
	//
	document.getElementById('vrpMsg').style.width=(msgWidth+12)+"px";
	document.getElementById('vrpMsg').style.height=(msgHeight+14)+"px";
	if(!document.all) {   // Firefox
	    oPage += "<div style='position: absolute; left: 10px; top: 10px; width: "+Trim(msgWidth)+"px; height: "+Trim(msgHeight)+"px;";
	    oPage += " background-color: black; filter: alpha(opacity=30); opacity: 0.30;'></div>";
    	oPage += "<div style='position: relative; height: "+Trim(msgHeight)+"px; width: "+Trim(msgWidth)+"px; border: solid 1px black;'>";
	} else {      // IE
	    oPage += "<div style='position: absolute; left: 10px; top: 10px; width: "+Trim(msgWidth)+"px; height: "+Trim(msgHeight+20)+"px;";
	    oPage += " background-color: black; filter: alpha(opacity=40); opacity: 0.40;'></div>";
    	oPage += "<div style='position: relative; height: "+Trim(msgHeight+20)+"px; width: "+Trim(msgWidth)+"px; border: solid 1px black;'>";
	}
	oPage += "<table border='0' cellpadding='3' cellspacing='0' width="+Trim(msgWidth)+" height="+Trim(msgHeight);
	oPage += " style='width: "+Trim(msgWidth)+"px; height: "+Trim(msgHeight)+"px;";
	oPage += " background-color: white; filter: alpha(opacity=96); opacity: 0.96;'>";
	oPage += "<tr style='background-image:url(/images/bg_bluestrip_22b.jpg); background-repeat:repeat-x;' ><td align='center' style='color:white;'><b>Ingedients</b></td>";
	oPage += "<td align='right'>";
	oPage += "<a href='' onClick=\"Ving(0,''); return false;\"><img src='/images/red-x.gif' border='0' title='Close' alt='Close'></a>";
	oPage += "</td></tr>";
	oPage += "<tr height='98%'><td height='98%' valign='top' colspan='2'><p align='justify'>";
	oPage += msgData;
	oPage += "</p></td></tr>";
	oPage += "</table>";
	oPage += "</div>";
	document.getElementById('vrpMsg').innerHTML= oPage;
}
