  function overlayopen(url,divid,blackoverlayid)
  {
   var geturl=url.toLowerCase()+"&"+Math.random();
   var browserName = whichBrs();
   var bodywidth=0,bodyheight=0;
   var leftPos=0,topPos=0,openinframe=0;
   var indexwidth=0,indexheight=0,setwidth=0,setheight=0;
   topPos=(screen.height / 2)-310;

   openinframe=geturl.indexOf("frame=yes");
   bodywidth = parseInt(document.body.scrollWidth);
   bodyheight = parseInt(document.body.scrollHeight);

   indexwidth=geturl.indexOf("width=");
   indexheight=geturl.indexOf("height=");

  //find width and height passing by parameters 
  if(geturl.indexOf("width=")>0 && geturl.indexOf("height=")>0)
	{
	 indexwidth=geturl.indexOf("width=")+6;
	 indexheight=geturl.indexOf("height=")+7;
	 setwidth= parseInt(geturl.substring(indexwidth,indexwidth+3),10);
	 setheight= parseInt(geturl.substring(indexheight,indexheight+3),10);
	}
	else{setwidth=730;setheight=460;}	// default width and height if it is not sending by parameters

  //set LeftPosition of overlay container
   if(setwidth < bodywidth && setheight < bodyheight){
	   leftPos=parseInt(bodywidth/2-setwidth/2,10);
	}
   else
	  {setwidth=730;setheight=460;}   // default width and height when wrong parameters passed

	//Check whether request to iframe or AJAX call
   if(openinframe > 0)
   {
   	var elm=document.getElementsByName("overlayiframe");
		for(var i=0;i<elm.length;i++)
		{
	   elm[i].style.background="";
	   window.frames["overlayiframe"].location=geturl;
	   elm[i].style.width=setwidth+"px";
	   elm[i].style.height=setheight+"px";
	   elm[i].style.display="block";
	   }
   }
   else{
   	if(document.getElementById("overlaybox")){
   		  document.getElementById("overlaybox").style.width=setwidth+"px";
		    document.getElementById("overlaybox").style.height=setheight+"px";
		    document.getElementById("overlaybox").style.display="block";
	   }
	}
	
	 document.getElementById(divid).style.left=leftPos+"px";
   document.getElementById(divid).style.top=topPos+"px";
   document.getElementById(blackoverlayid).style.height=bodyheight+"px";

   if(browserName=="IE"){document.getElementById(blackoverlayid).style.width=bodywidth+"px";document.getElementById(blackoverlayid).style.height=bodyheight+"px";}
   if(browserName=="Firefox"){document.getElementById(blackoverlayid).style.height=bodyheight+"px";	document.getElementById(divid).style.top=topPos-30+"px";}

  	document.getElementById(divid).style.display="block";
  	document.getElementById(blackoverlayid).style.display="block";
  }	
  
  
  function overlayclose(divid,blackoverlayid)  {
  	if(!document.getElementById) return;
  	if(divid=="overlaycontents"){
  		var elm=document.getElementsByName("overlayiframe");
			for(var i=0;i<elm.length;i++)
			{
  		  elm[i].style.display="none";
  			document.getElementById("overlaycontents").style.display="none";
  			document.getElementById(blackoverlayid).style.display="none";
  			window.frames["overlayiframe"].src=" ";
  			elm[i].style.background="transparent url('http://www.uiauthor.com/immense/common/images/generic/loading.gif') 50% 50% no-repeat";
  			}
  		}		
  	else{
  			document.getElementById("overlaycontentsDIV").style.display="none";
  			document.getElementById("overlaybox").style.display="none";
  			document.getElementById(blackoverlayid).style.display="none"; 
  			}
 	}
    
    
function whichBrs(){
		var agt=navigator.userAgent.toLowerCase();
		if (agt.indexOf("opera") != -1) return 'Opera';
		if (agt.indexOf("staroffice") != -1) return 'Star Office';
		if (agt.indexOf("webtv") != -1) return 'WebTV';
		if (agt.indexOf("beonex") != -1) return 'Beonex';
		if (agt.indexOf("chimera") != -1) return 'Chimera';
		if (agt.indexOf("netpositive") != -1) return 'NetPositive';
		if (agt.indexOf("phoenix") != -1) return 'Phoenix';
		if (agt.indexOf("firefox") != -1) return 'Firefox';
		if (agt.indexOf("safari") != -1) return 'Safari';
		if (agt.indexOf("skipstone") != -1) return 'SkipStone';
		if (agt.indexOf("msie") != -1) return "IE";
		if (agt.indexOf("netscape") != -1) return 'Netscape';
		if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
		if (agt.indexOf('\/') != -1) {
		if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
		return navigator.userAgent.substr(0,agt.indexOf('\/'));}
		else return 'Netscape';} else if (agt.indexOf(' ') != -1)
		return navigator.userAgent.substr(0,agt.indexOf(' '));
		else return navigator.userAgent;
}    