// 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", ""+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++;
    }
}


// Photo Gallery Paging
function GoPage(page) {

    if(page == "1") {
        document.getElementById("paging1").style.display = "block";
        document.getElementById("paging2").style.display = "none";
        document.getElementById("paging3").style.display = "none";
    }
    if(page == "2") {
        document.getElementById("paging1").style.display = "none";
        document.getElementById("paging2").style.display = "block";
        document.getElementById("paging3").style.display = "none";
    }
    if(page == "3") {
        document.getElementById("paging1").style.display = "none";
        document.getElementById("paging2").style.display = "none";
        document.getElementById("paging3").style.display = "block";
   }
}