// Opacity Onmouseover Images
function AlphaImage(who,state) {
	if(state=="on"){
		who.style.filter = 'alpha(opacity=50)';	
		who.style.opacity = 0.5;
	}
	else{
		who.style.filter = 'alpha(opacity=100)';
		who.style.opacity = 1;	
	}
}

// Popup Image
function PopupPic(sPicURL) {
    window.open("popup.html?"+sPicURL, "","resizable=1,HEIGHT=200,WIDTH=200");
}

// Check if the field is numeric
function IsNumeric(strString) {
	
	var strValidChars = "0123456789+.,-()";
	var strChar;
	var blnResult = true;

	//if (strString.length == 0) return false;
	
	for (i = 0; i < strString.length && blnResult == true; i++)
	  {
	  strChar = strString.charAt(i);
	  if (strValidChars.indexOf(strChar) == -1)
		 {
		 blnResult = false;
		 }
	  }
	return blnResult;
}

// Go Print!
function PrintNow() {
    var pop = window.open('print.html','','width=800,height=700,toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=no');
    if(pop.focus){ pop.focus(); }
}

// Change Main Pictures
function changepic(pic) {
    
    var splash = document.getElementById("splash");
    
    blendimage("splash","splashimg", "_gfx/"+pic+"",500);
    
}

//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 + ")";
}

//change the opacity for different browsers
function blendimage(divid, imageid, imagefile, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    
    //set the current image as background
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
    
    //make image transparent
    changeOpac(0, imageid);
    
    //make new image
    document.getElementById(imageid).src = imagefile;

    //fade in image
    for(i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
        timer++;
    }
}

// blink text
function doBlink() {
  // Blink, Blink, Blink...
  var blink = document.all.tags("BLINK")
  for (var i=0; i < blink.length; i++)
    blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}

function startBlink() {
  // Make sure it is IE4
  if (document.all)
    setInterval("doBlink()",1000)
}
window.onload = startBlink;