
var popupBgColor = "#ffffff" ;
var popupWindowColor = "#cccccc" ;
var popupWindowBorder = "2px solid #080990" ;

function popup(html) {
	var scrollY = getScrollY() ;
	var topY = (scrollY + 80) + "px" ;
	
	wrapper = document.getElementById('site-wrapper') ;
	div1 = document.createElement('div') ;
	div1.id = 'popup-translucent' ;
	div1.style.width = '100%' ;
	div1.style.height = '2000px' ;
	div1.onclick = function() {closePopup()}
	div1.style.position = 'absolute' ;
	div1.style.display = 'block' ;
	div1.style.cssfloat = 'left' ;
	div1.style.top = '0' ;
	div1.style.left = '0' ;
	div1.style.cursor = 'pointer' ;
	div1.style.zIndex = "1000" ;
	div1.style.backgroundColor = popupBgColor ;
	div1.style.padding = '25px' ;
	document.body.appendChild(div1) ;
	div2 = document.createElement('div') ;
	div2.id = 'popup-window' ;
	div2.style.height = '515px' ;
	div2.style.width = '480px' ;
	div2.style.border = popupWindowBorder ;
	div2.style.cssFloat = "left" ;
	div2.style.position = 'absolute' ;
	div2.style.display = 'block' ;
	div2.style.zIndex = "2000" ;
	div2.style.top = topY ;
	div2.style.left = '600px' ;
	div2.style.backgroundColor = popupWindowColor ;
	div2.style.padding = '10px' ;
	div2.style.fontSize = '18px' ;
	div2.innerHTML = html ;
	document.body.appendChild(div2) ;
	SetOpacity(div1, 50) ;
}

function closePopup() {
    var reMove = document.getElementById('popup-window');
    reMove.parentNode.removeChild(reMove);
    var reMove = document.getElementById('popup-translucent');
    reMove.parentNode.removeChild(reMove);
}

function SetOpacity(elem, opacityAsInt)
{
     var opacityAsDecimal = opacityAsInt;
     
     if (opacityAsInt > 100)
         opacityAsInt = opacityAsDecimal = 100; 
     else if (opacityAsInt < 0)
         opacityAsInt = opacityAsDecimal = 0; 
    
    opacityAsDecimal /= 100;
    if (opacityAsInt < 1)
        opacityAsInt = 1; // IE7 bug, text smoothing cuts out if 0
   
    elem.style.opacity = (opacityAsDecimal);
    elem.style.filter  = "alpha(opacity=" + opacityAsInt + ")";
}


function goFlash(file)
{
	var code2 = '<embed id="mymovie" width="480" height="485" allowfullscreen="true" quality="high" bgcolor="#cccccc" name="mymovie" style="" src="PaitecPlayer/paitecPlayer.swf?file=' + file + '" flashVars="file='+file+'" type="application/x-shockwave-flash"/>'
	code2 += "<br /><div style='color:#000000; float:right; font-size:14px; font-weight:bold; margin-top:12px; text-decoration:underline; cursor:pointer' onclick='closePopup()'>Close Window</div>" ;
	popup(code2) ;
}
function getScrollY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return scrOfY ;
}

