
IsIE = (document.all && navigator.userAgent.search(/MSIE/i) != -1)|| false;
function getPageSize ()
{
	var vXscroll,vYscroll;
	if(window.innerHeight && window.scrollMaxY)
	{
		vXscroll = document.body.scrollWidth;
		vYscroll = window.innerHeight + window.scrollMaxY;
	}
	else if(document.body.scrollHeight > document.body.offsetHeight)
	{
		vXscroll = document.body.scrollWidth;
		vYscroll = document.body.scrollHeight;
	}
	else
	{
		vXscroll = document.body.offsetWidth;
		vYscroll = document.body.offsetHeight;
	}
	
	var vWindowWidth,vWindowHeight;
	if(self.innerHeight)
	{
		vWindowWidth = self.innerWidth;
		vWindowHeight = self.innerHeight;
	}
	else if(document.documentElement && document.documentElement.clientHeight)
	{
		vWindowWidth  = document.documentElement.clientWidth;
		vWindowHeight = document.documentElement.clientHeight;
	}
	else if(document.body)
	{
		vWindowWidth  = document.body.clientWidth;
		vWindowHeight = document.body.clientHeight;
	}
	var vPageHeight,vPageWidth;
	
	if(vYscroll < vWindowHeight) vPageHeight = vWindowHeight;
	else vPageHeight = vYscroll;
	
	if(vXscroll < vWindowWidth) vPageWidth = vWindowWidth;
	else vPageWidth = vXscroll;
	return {vPageWidth:vPageWidth, vPageHeight:vPageHeight, vWindowWidth:vWindowWidth, vWindowHeight:vWindowHeight};
}
function loadPopupWindow(pmTitle,pmHeight,pmWidth,vSrc)
{
	vWidth=pmWidth.split("px");
	vheight=pmHeight.split("px");
		vW=vWidth[0]-10
		vH=vheight[0]-30
	vBackground = document.createElement('div');
	vBackground.id ='divParentPSO'
	vPageSize = getPageSize();
	vWdt=vPageSize.vPageWidth+35
	vBackground.style.width 	= vWdt+"px"; 
	vBackground.style.height 	= vPageSize.vPageHeight+"px"; 
	vBackground.style.left 	= "0px"; 
	vBackground.style.top 	= "0px"; 	
	vBackground.style.position 	= "absolute"; 	
	vBackground.style.opacity 	= ".5"; 	
	vBackground.style.backgroundColor 	= "#000000"; 	
	vBackground.style.filter 	= "alpha(opacity=50)"; 
	//vBackground.className 	= "popupBackgroundSafariIframe";
	
	vPosx	= (vPageSize.vWindowWidth/2)-(vWidth[0]/2)
	vPosy	= (vPageSize.vWindowHeight/2)-(vheight[0]/2)
	vPosx 	= vPosx+'px'; 
	vPosy 	= vPosy+'px';
	vPanel = document.createElement('div');
	vPanel.id ='divPanel'
	vPanel.style.width 	= pmWidth; 
	vPanel.style.height = pmHeight; 
	vPanel.style.left 	= vPosx; 
	vPanel.style.top 	= vPosy;
	vPanel.style.position='absolute'
	
	vPanel.innerHTML	= '<div class="mybgcolor" id="divPopupdiv" style="height:'+pmHeight+'; width:'+pmWidth+'; top:'+vPosy+'; left:'+vPosx+'; position:fixed;" align="center">'+getPopupWindowHeader( vWidth[0],vheight[0],pmTitle )+'<div id="divLoadingImg" align="left" style="width:'+vW+'px; height:'+vH+'px;"><table width="'+vW+'" height="'+vH+'" border="0" cellspacing="0" cellpadding="0" ><tr><td><table width="20%" border="0" align="center"><tr><td valign="middle"><img src="../../images/ajax-loader.gif" border="0"></td></tr></table></td></tr></table></div><div id="loadIframe" align="center" style="display:none;"><iframe src="'+vSrc+'" frameborder="0" id="iFrameSrc" height="'+vH+'" width="'+vW+'"></iframe></div>'+getPopupWindowBottom()+'</div>'
	hideallTags()
	document.body.appendChild(vBackground);
	setTimeout(function (){
						 document.body.appendChild(vPanel)
							setTimeout(function(){
													document.getElementById("divLoadingImg").style.display='none'
													fadeIn('divLoadingImg',0)
													document.getElementById("loadIframe").style.display='block'
													fadeIn('loadIframe',0)													
												},3000);
						 },1000);
}
function closePopupWindow()
{
	if(document.getElementById('divPanel'))
	{
		document.body.removeChild(document.getElementById('divPanel'));
	}
	if(document.getElementById('divParentPSO'))
	{
		document.body.removeChild(document.getElementById('divParentPSO'));
	}
	showAllTages();
}
function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}
function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100; 
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}
function getPopupWindowHeader( pmWidth,pmHeight,pmTitle ){
	var aHtml = [];
	aHtml.push('<table width="'+pmWidth+'" height="'+pmHeight+'" border="0" cellspacing="0" cellpadding="0" >');
	aHtml.push('<tr>')
	aHtml.push('<td align="left" valign="top" style="background-color:#E7D7DE;"><table width="100%" border="0" cellspacing="0" cellpadding="0">')
	aHtml.push('<tr>')
	aHtml.push('<td align="left" valign="top" height="25"></td>')
	aHtml.push('<td width="100%" align="left" valign="middle" ><table width="100%" border="0" cellspacing="0" cellpadding="0">')
	aHtml.push('<tr>')
	aHtml.push('<td width="4%">&nbsp;</td>')
	aHtml.push('<td width="87%" align="left" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;font-weight: bold;color: #000000;">'+pmTitle+'</td>')
	aHtml.push('<td width="7%" align="right" valign="middle"><a href="javascript:void(0)" onClick="closePopupWindow()"><b>Close</b></a></td>')
	aHtml.push('</tr>')
	aHtml.push('</table></td>')
	aHtml.push('<td align="left" valign="top"></td>')
	aHtml.push('</tr>')
	aHtml.push('<tr>')
	aHtml.push('<td align="left" valign="top" style="background-color:#E7D7DE;" >&nbsp;</td>')
	aHtml.push('<td align="left" height="100%" valign="top" style="background-color: #E7D7DE;">')
	return aHtml.join('');
}
function getPopupWindowBottom(){
	var aHtml = [];
	aHtml.push('</td>')
	aHtml.push('<td align="left" valign="top" style="background-color:#E7D7DE;" >&nbsp;</td>')
	aHtml.push('</tr>')
	aHtml.push('<tr>')
	aHtml.push('<td align="left" valign="top" height="5"></td>')
	aHtml.push('<td align="left" valign="top" >&nbsp;</td>')
	aHtml.push('<td align="left" valign="top" height="5"></td>')
	aHtml.push('</tr>')
	aHtml.push('</table></td>')
	aHtml.push('</tr>')
	aHtml.push('</table>')
	return aHtml.join('');
}
function hideallTags()
{
	aDiv=document.getElementsByTagName('div')
	for(i=0;i<aDiv.length;i++)
	{
		if(aDiv[i].id=='orderbutt')
			aDiv[i].style.display='none';
	}
	aSelect=document.getElementsByTagName('select')
	for(i=0;i<aSelect.length;i++)
	{
			aSelect[i].style.visibility='hidden';
	}
}
function showAllTages()
{
	aDiv=document.getElementsByTagName('div')
	for(i=0;i<aDiv.length;i++)
	{
		if(aDiv[i].id=='orderbutt')
			aDiv[i].style.display='block';
	}
	aSelect=document.getElementsByTagName('select')
	for(i=0;i<aSelect.length;i++)
	{
		aSelect[i].style.visibility='visible';
	}
}
function preview_popup(url,width,height)
{
	//window.open(url,"",'status=0, channelmode=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=0,toolbar=0,dialog=yes,modal=yes,alwaysRaised=yes, height=170, width=220, status=no, scroll=yes, left='+(screen.width/2-220)+',top='+(screen.height/2-150));
	//if (window.showModalDialog)
	//{
		//window.showModalDialog(url, window,'dialogHeight:'+height+'px; dialogWidth:'+width+'px; scroll:no; center:yes;')
	//}
	//else
	//{
		var PopupWindow=window.open(url,"",'status=0, channelmode=0,directories=0,location=0,menubar=0,resizable=0,scrollbars=1,toolbar=0,dialog=yes,modal=yes,alwaysRaised=yes, height='+height+', width='+width+', status=no, scroll=yes, left='+(screen.width/2-400)+',top='+(screen.height/2-600));
		if(PopupWindow)PopupWindow.focus();
		//window.open(url,"Player","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=700,height=350");
	//}
}