﻿// JScript File



function GetDocumentHeight() {
    if (document.all) 
        return document.body.offsetHeight;
    else if (document.layers)
        return document.body.document.height;
}


    function pageWidth() {return window.innerWidth != null? window.innerWidth: document.body != null? document.body.clientWidth:null;}
    
    function pageHeight() {return window.innerHeight != null? window.innerHeight: document.body != null? document.body.clientHeight:null;}
    
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{	// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 	// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);
if (BrowserDetect.browser == "Explorer" && version < 7){
//alert(version);
window.attachEvent("onload", correctPNG)}


    
    
    


//alert(BrowserDetect.browser);
function PopUpImage(w, h,url,image,description){
				// usage : PopUpImage(imageWidth,imageHeight,ImageFile,TextDescription)
				var e = window.open(url + '?image=' + image + '&text=' + description,'_viewimage','height='+(h+40)+',width='+(w+20));
				e.focus();
				var x = (screen.width-w)/2;
				var y = (screen.height-h+40)/2;
				e.moveTo(x,y-30);
				e.resizeTo(w+20,h+80);
				e.document.im.src='thumb1.jpg';
				
}
function chooseoption(option){
		
	window.document.open(option,'');			
}	

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 and 6.
{
    

   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 
		     var imgAttribs = img.attributes;
		     for (var j=0; j<imgAttribs.length; j++)
			 {
			    var imgAttrib = imgAttribs[j];
			    if (imgAttrib.nodeName == "align")
			    {		  
			       if (imgAttrib.nodeValue == "left") imgStyle = "float:left;" + imgStyle
			       if (imgAttrib.nodeValue == "right") imgStyle = "float:right;" + imgStyle
			       break
			    }
             }
		     var strNewHTML = "<span " + imgID + imgClass + imgTitle
		     strNewHTML += " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	         strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		     strNewHTML += "(src='" + img.src + "', sizingMethod='scale');\""
		     strNewHTML += " onmouseover=\"PNGswap('" + img.id + "');\" onmouseout=\"PNGswap('" + img.id +"');\""
		     strNewHTML += "></span>" 
		     img.outerHTML = strNewHTML
		     i = i-1
	      }
       }
   }
}

function PNGswap(myID)
{
	var strOver = "_on"
	var strOff = "_off"
	
	
	
	if (BrowserDetect.browser == "Explorer" && version < 7)
	{		  
	    	        
	       
		    var oSpan = document.getElementById(myID)		
		    var currentAlphaImg = oSpan.filters(0).src
	
    		if (currentAlphaImg.indexOf(strOver) != -1)
	    		oSpan.filters(0).src = currentAlphaImg.replace(strOver,strOff)
			else
		    	oSpan.filters(0).src = currentAlphaImg.replace(strOff,strOver)				
		    	
		    	
		}
		 
	else{
	    //alert('eee');
	
		var obj = document.getElementById(myID)
		
		var i = obj.src.indexOf(strOff)
				
		if (i > 0)
				obj.src = obj.src.replace("_off","_on")		
			else
				obj.src = obj.src.replace("_on","_off")		
			
	}
}