﻿// JScript File
function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
   
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if (
        aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return unescape(strReturn);
}
function toolTip(buttonName)
{   
    oButton = document.getElementById(buttonName);     
    
    if (navigator.appName == "Microsoft Internet Explorer"){
    
        var oText = oButton.outerHTML;        
        oButton.outerHTML = oText.replace(".png","_r.png");
        alert(oButton.outerHTML);
    
    } else {
        strImage = oButton.src;
        oButton.src = strImage.replace(".png","_r.png");
    }               
}
function toolTipOut(buttonName)
{
    oButton = document.getElementById(buttonName); 
      
    if (navigator.appName == "Microsoft Internet Explorer"){
        var oText = oButton.outerHTML;        
        oButton.outerHTML = oText.replace("_r.png",".png");
        alert(oButton.outerHTML);
    } else {
        strImage = oButton.src;
        oButton.src = strImage.replace("_r.png",".png");
    }  
}
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span "
            + " id=\"" + img.id + "\""
            + " style=\"" + "position: relative;width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML;
          
            i = i-1;
         }
      }
   }    
}

function trimAll(sString) {
	while (sString.substring(0,1) == ' '){
		sString = sString.substring(1, sString.length);
	}
	
	while (sString.substring(sString.length-1, sString.length) == ' '){
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

function getPage(mypage,myname,w,h,scroll,winPos,location,dirs,status,menubar,toolbar,resize){
	
	if(winPos == "random") {
		LeftPosition = (screen.width)?Math.floor(Math.random() * (screen.width - w)):100;
		TopPosition = (screen.height)?Math.floor(Math.random() * ((screen.height - h) - 75)):100;
	
	}
	
	else if(winPos == "center") {
		LeftPosition = (screen.width)?(screen.width - w) / 2:100;
		TopPosition = (screen.height)?(screen.height - h) / 2:100;
	
	}
	
	else if ((winPos != "center" && winPos != "random") || winPos==null) {
		LeftPosition = (screen.width)?(screen.width - w) - 10:100;
		TopPosition = 5;
	
	}
	
	settings = 'width='+ w +',height='+ h +',top='+ TopPosition +',left='+ LeftPosition +',scrollbars='+ scroll +',location=' + location + ',directories=' + dirs + ',status=' + status + ',menubar=' + menubar + ',toolbar=' + toolbar + ',resizable=' + resize;
	popWin = window.open(mypage,myname,settings);

}

