var dragapproved=false;
var minrestore=0;
var initialwidth,initialheight;
var ie5=document.all&&document.getElementById;
var ns6=document.getElementById&&!document.all;
function iecompattest(){
return(!window.opera&&document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;
}
function drag_drop(e){
if(ie5&&dragapproved&&event.button==1)
{
document.getElementById("dwindow").style.left=tempx+event.clientX-offsetx+"px";
document.getElementById("dwindow").style.top=tempy+event.clientY-offsety+"px";
}
else if(ns6&&dragapproved)
{
document.getElementById("dwindow").style.left=tempx+e.clientX-offsetx+"px";
document.getElementById("dwindow").style.top=tempy+e.clientY-offsety+"px";
}
}
function initializedrag(e)
{
offsetx=ie5?event.clientX:e.clientX;
offsety=ie5?event.clientY:e.clientY;
tempx=parseInt(document.getElementById("dwindow").style.left);
tempy=parseInt(document.getElementById("dwindow").style.top);
dragapproved=true;
document.getElementById("dwindow").onmousemove=drag_drop;
}
function ShowCustomizationPage(pagename,width,height,title)
{
if(pagename=="HomePage.xml")
{
url="WebPages/Customization/PageTemp.aspx?filename="+pagename;
}
else
{
url="../../WebPages/Customization/PageTemp.aspx?filename="+pagename;
}
document.getElementById("cframe").src=url;
ShowModalPopup('dwindow',title+' - Customization');
}
function maximize()
{
if(minrestore==0)
{
minrestore=1
document.getElementById("maxname").setAttribute("src","restore.gif");
document.getElementById("dwindow").style.width=ns6?window.innerWidth-20+"px":iecompattest().clientWidth+"px";
document.getElementById("dwindow").style.height=ns6?window.innerHeight-20+"px":iecompattest().clientHeight+"px";
}
else
{
minrestore=0;
document.getElementById("maxname").setAttribute("src","max.gif");
document.getElementById("dwindow").style.width=initialwidth;
document.getElementById("dwindow").style.height=initialheight;
}
document.getElementById("dwindow").style.left=ns6?window.pageXOffset+"px":iecompattest().scrollLeft+"px";
document.getElementById("dwindow").style.top=ns6?window.pageYOffset+"px":iecompattest().scrollTop+"px";
}
function closepopup()
{
document.getElementById("cframe").contentWindow.close();
document.getElementById("dwindowcontent").removeChild(document.getElementById("cframe"));
document.getElementById("dwindow").style.display="none";
document.getElementById("dwindow").innerHTML="";
document.body.removeChild(document.getElementById("dwindow"));
if(document.getElementById("copyToDropDown")!=null)
{
document.getElementById("copyToDropDown").style.display='inline';
}
if(document.getElementById("MyLibFilter")!=null)
{
document.getElementById("MyLibFilter").style.display='inline';
}
document.body.style.backgroundColor=orgbgcolor;
document.getElementById("bg_image").style.display="none";
}
function closepopupandreload()
{
closepopup('dwindow');
ReloadPageCSSFile();
}
var xmlHttpObject;
function ReloadPageCSSFile()
{
var objCSS;
objCSS=document.getElementById("dynamicCSS");
if(objCSS!=null)
{
document.body.removeChild(objCSS);
}
var obj;
obj=document.createElement("link",obj);
obj.setAttribute("id","dynamicCSS");
obj.setAttribute("rel","stylesheet");
obj.setAttribute("type","text/css");
var date=new Date();
var cssPageCSS;
if(cssFileName=="MyProfile.css")
{
var userId=document.getElementById("PageFooter_hUserId").value;
cssPageCSS="../../CustomizedCSS/"+userId+cssFileName;
}
else
{
cssPageCSS=cssFileName;
}
obj.setAttribute("href",cssPageCSS+"?"+date.getTime());
document.body.appendChild(obj);
}
function GetChangedCSS()
{
xmlHttpObject=null;
xmlHttpObject=GetXmlHttpObject();
if(xmlHttpObject==null)
{
alert("Browser does not support HTTP Request.");
return;
}
var url="";
url="Default.aspx";
xmlHttpObject.onreadystatechange=stateChangedForCSS;
alert(xmlHttpObject);
xmlHttpObject.open("GET",url,true);
xmlHttpObject.send(null);
return false;
}
function stateChangedForCSS()
{
if(xmlHttpObject.readyState==4)
{
var objCSS;
objCSS=document.getElementById("dynamicStyleSheet");
if(objCSS!=null)
{
}
if(objCSS!=null)
{
document.body.removeChild(objCSS);
}
var obj;
obj=document.createElement("style",obj);
obj.setAttribute("id","dynamicStyleSheet");
obj.setAttribute("type","text/css");
obj.styleSheet.cssText=xmlHttpObject.responseText;
document.body.appendChild(obj);
alert("The page CSS file is changed.");
}
}
function GetXmlHttpObject()
{
var objXMLHttp=null;
if(window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
return objXMLHttp;
}
function stopdrag()
{
dragapproved=false;
document.getElementById("dwindow").onmousemove=null;
document.getElementById("dwindowcontent").style.display="";
}
function DisableBackgroundOld()
{
var objBlankImage;
objBlankImage=document.getElementById("bg_image");
if(objBlankImage==null)
{
try
{
objBlankImage=document.createElement('<img id="bg_image" style="z-index: 900; left: 0px; width: 101%; position: absolute; top: -100px; height: auto; background-color: Silver; display:none; border-right: 0px solid; border-top: 0px solid; border-left: 0px solid; border-bottom: 0px solid;">');
}
catch(e)
{
objBlankImage=document.createElement("img");
objBlankImage.setAttribute("id","bg_image");
objBlankImage.setAttribute("style","z-index: 900; left: 0px; width: 100%; position: absolute; top: -100px; height: 200%; background-color: Silver; display:block; border-right: 0px solid; border-top: 0px solid; border-left: 0px solid; border-bottom: 0px solid;");
}
}
objBlankImage.style.left=document.body.offsetLeft;
orgbgcolor=document.body.style.backgroundColor;
document.body.style.backgroundColor="Silver";
objBlankImage.style.filter="alpha(opacity=50)";
objBlankImage.style.MozOpacity="0.5";
objBlankImage.style.display='block';
document.body.appendChild(objBlankImage);
if(document.getElementById("copyToDropDown")!=null)
{
document.getElementById("copyToDropDown").style.display='none';
}
if(document.getElementById("MyLibFilter")!=null)
{
document.getElementById("MyLibFilter").style.display='none';
}
}
function DisableBackground()
{
var objBlankImage;
objBlankImage=document.getElementById("bg_image");
if(objBlankImage==null)
{
try
{
objBlankImage=document.createElement('<div id="bg_image" style="z-index: 900; left: 0px; width: 100%; position: absolute; top: 0px; height: auto; background-color:#333333; display:none; border-right: 0px solid; border-top: 0px solid; border-left: 0px solid; border-bottom: 0px solid;">');
}
catch(e)
{
objBlankImage=document.createElement("div");
objBlankImage.setAttribute("id","bg_image");
objBlankImage.setAttribute("style","z-index: 900; left: 0px; width: 100%; position: absolute; top: 0px; height: 100%; background-color:#333333; display:block; border-right: 0px solid; border-top: 0px solid; border-left: 0px solid; border-bottom: 0px solid;");
}
}
orgbgcolor=document.body.style.backgroundColor;
document.body.style.backgroundImage="";
objBlankImage.style.filter="alpha(opacity=50)";
objBlankImage.style.MozOpacity="0.5";
objBlankImage.style.display='block';
document.body.appendChild(objBlankImage);
objBlankImage.style.height=(document.body.offsetHeight)+10+"px";
if(document.all)
{
objBlankImage.style.width=(document.body.offsetWidth)+(document.body.offsetLeft*2)+"px";
}
}
function RefreshPage()
{
document.getElementById("UpdatePanel1").innerHTML=document.getElementById("UpdatePanel1").innerHTML;
}

