
//iView by Andy 5/29/08
var SitePath = "http://www.curbellplastics.com/"
var ObjID=""; var ObjHTML=""; var LeftStay=0; var TopStay=0;
function WHXYPos()		{winX=document.body.scrollLeft;winY=document.body.scrollTop;winH=document.body.clientHeight;winW=document.body.clientWidth;}
function iView(i,t)		{if(i==null || document.getElementById('GreyOut')){return false}; window.focus(); WHXYPos(); tbody=document.getElementsByTagName("body")[0]; if(navigator.appName=="Microsoft Internet Explorer"){Iframe=document.createElement('iframe');opacity=0;opaque=(opacity/100);Iframe.id='Iframe';Iframe.style.position='absolute';Iframe.style.left=winX;Iframe.style.top=winY;Iframe.style.height=winH;Iframe.style.width=winW;Iframe.style.zIndex=40;Iframe.style.opacity=opaque;Iframe.style.MozOpacity=opaque;Iframe.style.filter='alpha(opacity='+opacity+')';tbody.appendChild(Iframe);}; GreyOut=document.createElement('div'); opacity=70;opaque=(opacity/100); GreyOut.id='GreyOut'; GreyOut.style.backgroundColor='#000000'; GreyOut.style.position='absolute'; GreyOut.style.left=winX; GreyOut.style.top=winY; GreyOut.style.height=winH; GreyOut.style.width=winW; GreyOut.style.zIndex=50; GreyOut.style.opacity=opaque; GreyOut.style.MozOpacity=opaque; GreyOut.style.filter='alpha(opacity='+opacity+')'; tbody.appendChild(GreyOut); WinPop=document.createElement('div'); WinPop.id='WinPop'; WinPop.style.position='absolute'; WinPop.style.left='0px'; WinPop.style.top=winY; WinPop.style.zIndex=60; tbody.appendChild(WinPop); WinPop = document.getElementById('WinPop'); ShwObj=0; LoadingImage = new Image(); LoadingImage.onload=function(){if(ShwObj==0){ShwObj=1; WinPop.style.visibility='hidden'; WinPop.innerHTML='<div style="text-align:center" title="Loading..."><img id="Loading" src="'+ SitePath +'images/ajax/loading-winpop.gif" border="0" vspace="10"><br><img src="'+ SitePath +'images/ajax/loading-text.gif" width="46" height="5" border="0" alt=""></div>'; CenterPop(); WinPop.style.visibility='visible'; if(i.indexOf('.')>-1 && ShwObj==1){LoadImg(i,t)} else{LoadObj(i,t)}}}; LoadingImage.src = SitePath +'images/ajax/loading-winpop.gif';} //document.getElementById('GreyOut').onclick = function(){ClosePop()}; 
function LoadImg(i,t)	{i = i.replace('../',''); ObjImage = new Image(); ObjImage.onload = function(){if(document.getElementById('GreyOut')){if(t!=undefined){ImgInfo = '<tr><td>'+ t +'</td></tr>'}else{ImgInfo=''}; WinPop.style.visibility='hidden'; WinPop.innerHTML='<div id="WinX"></div><table id="itb" width='+ ObjImage.width +' bgcolor="#ffffff" cellpadding="0" cellspacing="10"><tr><td valign="top"><img name="image" src='+ SitePath + i +' border="0"></td></tr>'+ ImgInfo +'</table>'; WinX(); CenterPop(); WinPop.style.visibility='visible'; WinPopFade();}}; ObjImage.src = SitePath + i}
function WinX()			{winX = document.getElementById('WinX'); winX.innerHTML = '<table cellpadding="0" cellspacing="4" onclick="ClosePop()" title="Close"><tr><td style="font:bold 11px arial" height="16" align="right" width="22" valign="top">[x]</td><td style="font:bold 11px arial; padding-top:1px;" width="38" valign="top">Close</td></tr></table>'; winX.style.backgroundColor='#ffffff'; winX.style.position='relative'; winX.style.cursor='default'; if(ObjID!=''){winX.style.marginLeft=document.getElementById('otb').offsetWidth-72;} else{winX.style.marginLeft=document.getElementById('itb').offsetWidth-72;}; winX.style.top='10px'; winX.style.width='72px';}
function LoadObj(i,f)	{WinPop.style.visibility='hidden'; ObjID = i; ObjHTML = document.getElementById(i).innerHTML; var tbody = document.getElementsByTagName("body")[0]; tbody.removeChild(document.getElementById(i)); WinPop.innerHTML = '<div id="WinX"></div><table id="otb" bgcolor="#ffffff" cellpadding="0" cellspacing="10"><tr><td valign="top">'+ ObjHTML +'</td></tr></table>'; if(ObjHTML.indexOf('ClosePop()')==-1){WinX()}; CenterPop(); WinPop.style.visibility='visible'; WinPopFade(); if(f!=undefined && f.indexOf('|')!=-1){frmfocus = f.split("|"); setTimeout("document."+ frmfocus[0] +"."+ frmfocus[1] +".focus()",200)}}
function CenterPop()	{ScreenH = winH; ScreenW = winW; WinPopH = WinPop.offsetHeight+24; WinPopW = WinPop.offsetWidth; if(ScreenH > WinPopH && ScreenW > WinPopW){TopStay=0; LeftStay=0; WinPop.style.top = (ScreenH - WinPopH) / 2 + document.body.scrollTop; WinPop.style.left = (ScreenW - WinPopW) / 2 + document.body.scrollLeft; WinPop.style.padding='0px'; stay=0} else if(ScreenH < WinPopH && ScreenW < WinPopW){if(LeftStay==0){WinPop.style.left='0px'; WinPop.style.top=document.body.scrollTop}; LeftStay=1} else{if(ScreenH > WinPopH){WinPop.style.left='0px'; WinPop.style.top = (ScreenH - WinPopH) / 2 + document.body.scrollTop} else if(ScreenW > WinPopW){WinPop.style.left=(ScreenW - WinPopW) / 2 + document.body.scrollLeft; if(TopStay==0){WinPop.style.top=document.body.scrollTop; TopStay=1}}}}
function WinPopFade(f)	{if(document.getElementById('WinPop')){if(f==undefined){f=0}; opacity=f; opaque=(opacity/100); WinPop.style.opacity=opaque; WinPop.style.MozOpacity=opaque; WinPop.style.filter='alpha(opacity='+opacity+')'; if(f==120){clearTimeout(t); return false}; n = f + 20; var t = setTimeout('WinPopFade(n)',10)}}
function ClosePop()		{var tbody = document.getElementsByTagName("body")[0]; if(document.getElementById('Iframe')){tbody.removeChild(document.getElementById('Iframe'))}; if(document.getElementById('GreyOut')){tbody.removeChild(document.getElementById('GreyOut'))}; if(document.getElementById('WinPop')){tbody.removeChild(document.getElementById('WinPop'))}; if(ObjID!=''){ObjDiv=document.createElement('div'); ObjDiv.id=ObjID; ObjDiv.style.display='none'; tbody.appendChild(ObjDiv); document.getElementById(ObjID).innerHTML = ObjHTML; ObjID=""; ObjHTML="";}; stay=0}
function RefreshPos()	{RefreshWHXY();setTimeout("RefreshWHXY()",10)}
function RefreshWHXY()	{if(document.getElementById('GreyOut')){WHXYPos(); if(document.getElementById('Iframe')){Iframe=document.getElementById('Iframe');Iframe.style.left=winX;Iframe.style.top=winY;Iframe.style.height=winH;Iframe.style.width=winW}; GreyOut=document.getElementById('GreyOut');GreyOut.style.left=winX;GreyOut.style.top=winY;GreyOut.style.height=winH;GreyOut.style.width=winW; CenterPop()}}
function Esc(e)			{if(document.getElementById('GreyOut')){evt=(e) ? e : window.event;if(evt.keyCode==27){ClosePop()}}}
document.onkeydown = Esc; window.onscroll = RefreshPos; window.onresize = RefreshPos;
