var agt = navigator.userAgent.toLowerCase();

var ie = ((agt.indexOf("msie")!=-1) && (agt.indexOf("opera")==-1));

var ff = (agt.indexOf("firefox")!=-1);

var mac = (agt.indexOf("mac")!=-1);

var safari = (agt.indexOf("safari")!=-1);

var windows = (agt.indexOf("windows")!=-1);

var opera = (agt.indexOf("opera")!=-1);

var lightBoxOpacity = 70;

function LoadIFrame(intWidth,intHeight,stringPageSource)
{
		FlashScreenOut();
		DisplayIFrame(intWidth,intHeight,stringPageSource);
}

function DisplayIFrame(intWidth,intHeight,stringSrc)
{

        if(document.URL.toString().indexOf('www.') == -1)
        {
              stringSrc = stringSrc.toString().replace("http://www.", "http://");
        }

	var doc = window.parent.document;
	
	var playerObj = doc.getElementById("FrameLocation"); 
	
	var intTopSet = (screen.height / 8);
	
	if(!playerObj)
	{
		var dabody = doc.getElementsByTagName('body')[0];
		playerObj = doc.createElement("div");
		playerObj.id = "FrameLocation";
		playerObj.style.position = "absolute";
		playerObj.style.top = intTopSet+ 'px';
		playerObj.style.left =  '50%';
		playerObj.style.zIndex = "100";
		playerObj.style.visibility = "hidden";
		playerObj.style.overflow = "visible";
		dabody.appendChild(playerObj);	
	}
		
	playerObj.innerHTML = '<iframe id="playerFrame"  name="playerFrame" src="'+stringSrc+'" allowtransparency="true" frameborder="0" scrolling="no" vspace="0" hspace="0" marginwidth="0" marginheight="0" style="background-color:transparent;border:1px solid black;width:'+intWidth+'px;height:'+intHeight+'px;margin-left:-'+(intWidth/2)+'px"></iframe>';
	
	playerObj.style.visibility = "visible";
}

function FlashScreenOut()
{
	var doc = window.parent.document;

	var maskObj = doc.getElementById("Flash"); 
	
	if(!maskObj){
		
		var dabody = doc.getElementsByTagName('body')[0];
		maskObj = doc.createElement("div");
		maskObj.id = "Flash";
		maskObj.style.position = "absolute";
		maskObj.style.top = "0px";
		maskObj.style.left = "0px";
		maskObj.style.width = "100%";
		maskObj.style.zIndex = "10";
		maskObj.style.visibility = "hidden";
		
		var userAgent = navigator.userAgent.toLowerCase();
		if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) 
		{
			maskObj.style.backgroundRepeat = "repeat";
			maskObj.style.backgroundImage = "url(themes/images/mask70.png)";
			maskObj.innerHTML = '<iframe src="about:blank" style="position:absolute;top:0;left:0;z-index:-1;width:100%;height:99%;"></iframe>';	
		}
		else
		{
			maskObj.style.backgroundColor = "#000000";
			maskObj.style.MozOpacity = lightBoxOpacity/100;
			maskObj.style.opacity = lightBoxOpacity/100;
    		maskObj.style.filter = "alpha(opacity="+ lightBoxOpacity +")";			
			if(userAgent.indexOf("msie 6") != -1)//use iframe to maskout selects in ie 6
				maskObj.innerHTML = '<iframe src="about:blank" style="position:absolute;top:0;left:0;z-index:-1;filter:mask();width:3000px;height:3000px;"></iframe>';
		}		
		dabody.appendChild(maskObj);
	}
	
	var clientHeight = parent.innerHeight ? parent.innerHeight : parent.document.documentElement.clientHeight;
	
	var scrollHeight; 
	if(window.innerHeight && window.scrollMaxY){//ff
		scrollHeight = parent.innerHeight + parent.scrollMaxY;
	}else if(doc.documentElement && doc.documentElement.scrollHeight > doc.documentElement.offsetHeight){ // ie strict mode
		scrollHeight = doc.documentElement.scrollHeight - (doc.documentElement.scrollHeight-doc.body.offsetHeight);
	}else{
		scrollHeight = doc.body.offsetHeight;
		if(!ie)
			scrollHeight += 20;
	}
	
	clientHeight = scrollHeight > clientHeight ? scrollHeight : clientHeight;
	
	maskObj.style.height = clientHeight + "px";
	
	maskObj.style.visibility = "visible";	
}