function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} 
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
function xmlHttpAx() // Make xml request
{
   var xmlHttp = null;
   try { 
       // Firefox, Opera 8.0+, Safari
       xmlHttp=new XMLHttpRequest();
   }
   catch (e) {
       // Internet Explorer
       try { 
           xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); 
       }
       catch (e) {
          try { 
              xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); 
          }
          catch (e) {
              alert("Your browser does not support AJAX!");
              return false;
          }
       }
    }
    return xmlHttp;
}
function loadXMLDoc(dname) 
{
	try //Internet Explorer
	{
	xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	}
	catch(e)
	{
	  try //Firefox, Mozilla, Opera, etc.
		{
		xmlDoc=document.implementation.createDocument("","",null);
		}
	  catch(e) {alert(e.message)}
	}
	try {
	  xmlDoc.async=false;
	  xmlDoc.load(dname);
	  return(xmlDoc);
	  }
	catch(e) {alert(e.message)}
	return(null);
}
function loadXMLString(txt) 
{
	try //Internet Explorer
	  {
	  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	  xmlDoc.async="false";
	  xmlDoc.loadXML(txt);
	  return(xmlDoc); 
	  }
	catch(e)
	  {
	  try //Firefox, Mozilla, Opera, etc.
		{
		parser=new DOMParser();
		xmlDoc=parser.parseFromString(txt,"text/xml");
		return(xmlDoc);
		}
	  catch(e) {alert(e.message)}
	  }
	return(null);
}
function OpenWindow(nav)
{
	var w = 500;
	var h = 250;
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = "top=" + wint + ", left=" + winl + ", resizable=no, scrollbars=no, width="+ w + ", height="+ h;
	window.open(nav, "sendtofriend", winprops);
}
function fixPNG(myImage, url) 
{
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"><img src='images/spacer.gif' style='width:" + myImage.width + "px; height:" + myImage.height + "px; cursor:pointer;' onclick=\"window.location.href='" + url + "'\" /></span>"
	   myImage.outerHTML = strNewHTML  
    }
}
function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    }
	
}
//change the opacity for different browsers 
function changeOpac(opacity, id) 
{ 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}
function page_disable(val) {
    if(val == 1)
    {
        var pageHeight = document.body.offsetHeight;
        var pageWidth = document.body.offsetWidth;

        dv = document.createElement('div');
        dv.setAttribute('id',"lyr0");                  
        dv.style.position = "absolute";  
        dv.style.left = 0 + 'px';
        dv.style.top = 0 + 'px';
		dv.style.zIndex = 20;
        dv.style.width = pageWidth + 'px';
        dv.style.height = pageHeight + 'px';
        dv.style.background = "#c0c0c0";
        dv.style.opacity = 0.4;
        dv.style.filter = "progid:DXImageTransform.Microsoft.alpha(opacity=40)";
        //dv.attachEvent("onmouseclick",function(){element_event_onmouseclick();}); 
        document.body.appendChild(dv);
    }
	else
    {
        var dv = document.getElementById('lyr0');
        if(dv != null)
            dv.parentNode.removeChild(dv);
    }
}
