﻿
			function fnToggleLinkOn(Link) {
				Link.filters[0].Apply();                    
				Link.filters[0].Play();
				Link.className ="toplinkhigh"; 
			}
			function fnToggleLinkOff(Link) {
				Link.filters[0].Apply();                    
				Link.filters[0].Play();
				Link.className ="toplink";   
			}
			function fnToggleLinkBottomOn(Link) {
				Link.filters[0].Apply();                    
				Link.filters[0].Play();
				Link.className ="linkbottom"; 
			}
			function fnToggleLinkBottomOff(Link) {
				Link.filters[0].Apply();                    
				Link.filters[0].Play();
				Link.className ="linkbottomhigh";   
			}
			function stripSpaces(inputString)
			{
			var spaceFind = /\W/g;
			var strInput = inputString;
			var strOutput = "";
			strOutput = strInput.replace(spaceFind,"");
			return strOutput;
			}
		
			function MM_swapImgRestore() 
			{ 
			var i,x,a=document.MM_sr; 
			for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
			}

			function MM_preloadImages() 
			{
			var d=document; 
			if(d.images){ if(!d.MM_p) d.MM_p=new Array();
			var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
			for(i=0; i<a.length; i++)
			if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
			}	

			function MM_findObj(n, d) 
			{ 
			var p,i,x;  
			if(!d) d=document; 
			if((p=n.indexOf("?"))>0&&parent.frames.length) {
			d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
			if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
			for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
			if(!x && document.getElementById) x=document.getElementById(n); return x;
			}

			function MM_swapImage() 
			{ 
			var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
			if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
			}
			function NewWindow(url,name) {
				window.open(url,name,'height=800,width=800,status=yes,toolbar=yes,menubar=yes,resizable=1,scrollbars=1,titlebar=yes,location=yes,top=30,left=30');	
				}
			function NewWindowC(url,name) {
				window.open(url,name,'height=450,width=600,status=no,toolbar=0,menubar=0,resizable=0,scrollbars=0,titlebar=0,location=no,top=30,left=30');	
			}	
			
			function NewWindowSS(url,name) {
				window.open(url,name,'height=502,width=560,status=0,toolbar=0,menubar=0,resizable=0,scrollbars=0,titlebar=0,location=0,top=30,left=30');	
			}	
			
			function NewWindowVT(url,name) {
				window.open(url,name,'height=420,width=560,status=0,toolbar=0,menubar=0,resizable=0,scrollbars=0,titlebar=0,location=0,top=30,left=30');	
			}	
			
			function NewWindowP(url,name) {
				window.open(url,name,'height=650,width=780,status=no,toolbar=yes,menubar=1,resizable=1,scrollbars=1,titlebar=1,location=no,top=30,left=30');	
			}	
			
			function NewWindowZoom(url,name) {
				window.open(url,name,'height=10,width=10,status=no,toolbar=no,menubar=no,resizable=1,scrollbars=1,titlebar=no,location=no,top=30,left=30');					
			}
			
			function OpenWindow(url) {
				window.open(url,'_self','height=550,width=550,status=no,toolbar=no,menubar=no,resizable=1,scrollbars=1,titlebar=no,location=no,top=30,left=30');	
			}
			
			function NewWindowL(url,name) {
				window.open(url,name,'height=800,width=900,status=no,toolbar=no,menubar=0,resizable=1,scrollbars=1,titlebar=1,location=no,top=30,left=30');	
			}
			
			function NewWindowImage(url,name) {
				window.open(url,name,'height=10,width=10,status=no,toolbar=no,menubar=no,resizable=1,scrollbars=1,titlebar=no,location=no,top=30,left=30');					
			}

            function OpenWindowP(url) {
				window.open(url,'_parent','height=550,width=550,status=no,toolbar=no,menubar=no,resizable=1,scrollbars=1,titlebar=no,location=no,top=30,left=30');	
			}

    function clearSearch(elem, text) 
    {
	    if( elem.value == text ) 
	    {
		    elem.value = "";
	    }
	}
	
	function DisableButton() {

                window.setTimeout("disableButton('" + 
                   window.event.srcElement.id + "')", 0);
            }

            function disableButton(buttonID) {
                document.getElementById(buttonID).disabled=true;
                document.getElementById(buttonID).value="LOADING..."
            }
            
            function clearInput(obj,str,flg)
{
	if (flg==0)
	{
		if (obj.value==str || obj.value=="")
		{
			obj.value=str
		}
	}
	if (flg==1)
	{
		if (obj.value==str)
		{
			obj.value=""
		}
	}

}

function imageholderclass(){
	this.over=new Array();
	this.down=new Array();
	this.src=new Array();
	this.store=store;
	
	function store(src, down, over){
		var AL=this.src.length;
		this.src[AL]=new Image(); this.src[AL].src=src;
		this.over[AL]=new Image(); this.over[AL].src=over;
		this.down[AL]=new Image(); this.down[AL].src=down;
	}
}

var ih = new imageholderclass();
var mouseisdown=0;

function preloader(t){
	for(i=0;i<t.length;i++){
		if(t[i].getAttribute('srcover')||t[i].getAttribute('srcdown')){
			
			storeimages(t[i]);
			var checker='';
			checker=(t[i].getAttribute('srcover'))?checker+'A':checker+'';
			checker=(t[i].getAttribute('srcdown'))?checker+'B':checker+'';
			
			switch(checker){
			case 'A' : mouseover(t[i]);mouseout(t[i]); break;
			case 'B' : mousedown(t[i]); mouseup2(t[i]); break;
			case 'AB' : mouseover(t[i]);mouseout(t[i]); mousedown(t[i]); mouseup(t[i]); break;
			default : return;			
			}
			
			if(t[i].src){t[i].setAttribute("oldsrc",t[i].src);}
		}
	}
}
function mouseup(t){
	var newmouseup;
	if(t.onmouseup){
		t.oldmouseup=t.onmouseup;
		newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("srcover");this.oldmouseup();}

	}
	else{newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("srcover");}}
	t.onmouseup=newmouseup;
}

function mouseup2(t){
	var newmouseup;
	if(t.onmouseup){
		t.oldmouseup=t.onmouseup;
		newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("oldsrc");this.oldmouseup();}
		}
	else{newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("oldsrc");}}
	t.onmouseup = newmouseup;
}

function mousedown(t){
	var newmousedown;
	if(t.onmousedown){
		t.oldmousedown=t.onmousedown;
		newmousedown=function(){if(mouseisdown==0){this.src=this.getAttribute("srcdown");this.oldmousedown();}}
	}
	else{newmousedown=function(){if(mouseisdown==0){this.src=this.getAttribute("srcdown");}}}
	t.onmousedown=newmousedown;
}

function mouseover(t){
	var newmouseover;
	if(t.onmouseover){
		t.oldmouseover=t.onmouseover;
		newmouseover=function(){this.src=this.getAttribute("srcover");this.oldmouseover();}
	}
	else{newmouseover=function(){this.src=this.getAttribute("srcover");}}
	t.onmouseover=newmouseover;
}

function mouseout(t){
	var newmouseout;
	if(t.onmouseout){
		t.oldmouseout=t.onmouseout;
		newmouseout=function(){this.src=this.getAttribute("oldsrc");this.oldmouseout();}
	}
	else{newmouseout=function(){this.src=this.getAttribute("oldsrc");}}
	t.onmouseout=newmouseout;
}

function storeimages(t){
	var s=(t.getAttribute('src'))?t.getAttribute('src'):'';
	var d=(t.getAttribute('srcdown'))?t.getAttribute('srcdown'):'';
	var o=(t.getAttribute('srcover'))?t.getAttribute('srcover'):'';
	ih.store(s,d,o);
}

function preloadimgsrc(){
	if(!document.getElementById) return;
	var it=document.getElementsByTagName('IMG');
	var it2=document.getElementsByTagName('INPUT');
	preloader(it);
	preloader(it2);
}

if(window.addEventListener){window.addEventListener("load", preloadimgsrc, false);} 
else{
	if(window.attachEvent){window.attachEvent("onload", preloadimgsrc);}
	else{if(document.getElementById){window.onload=preloadimgsrc;}}
}

function replaceSubstring(inputString, fromString, toString) {
   // Goes through the inputString and replaces every occurrence of fromString with toString
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      // Find a string that doesn't exist in the inputString to be used
      // as an "inbetween" string
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } // Keep on going until we build an "inbetween" string that doesn't exist
      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      // Next, replace the "inbetween" string with the "toString"
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } // Ends the check to see if the string being replaced is part of the replacement string or not
   return temp; // Send the updated string back to the user
} // Ends the "replaceSubstring" function