// 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(aggeliestype,id) {
    var pop = window.open("print.webman?aggeliestype="+aggeliestype+"&id="+id+"","","width=930,height=700,toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=no");
    if(pop.focus){ pop.focus(); }
}

// STARTS TOP MENU FADE EFFECT
function setOpacity(domId, val) {
	obj = document.getElementById(domId);
	obj.style.MozOpacity = val;
	obj.style.opacity = val/10;
	obj.style.filter = 'alpha(opacity=' + val*10 + ')';
};
function fade(domId){
	obj = document.getElementById(domId); //Get the Element

	 if(obj.style.display == "none") return false; //Return false if the element is already hidden

	 var alpha = 10; //Set the initial value of alpha to 10 (Opaque)
	 function f(){ //Internal function

	  alpha--; //Decrement the alpha value
	  setOpacity(domId, alpha); //Set the opacity of our element to the specified alpha

	  if(alpha > -1){ //If alpha is still bigger than -1 then..
	   setTimeout(f, 100); //..then call the function again after 100 milliseconds

	  }else{ //otherwise..
	   obj.style.display = 'none'; //..otherwise now that we cant see the element anyways, hide it

	  }
	}
	setTimeout(f, 100); //This is where we call the f() function for the first time
};
function appear(domId){
	obj = document.getElementById(domId); //Get the element

	 if(obj.style.display != "none") return false; //Return if it is already being displayed

	 obj.style.display = ''; //Un-hide the object before its animation
	 var alpha = 0; //Set the initial value of alpha to 0 (invisible)

	 function a(){ //Internal function
	  alpha++; //Increment alpha

	  setOpacity(domId, alpha); //Set the opacity of our element to the specified alpha
	  if(alpha < 11)setTimeout(a, 100);

	/*Till alpha is 10, keep calling the
	a() function after 100 milliseconds */
	}
	setTimeout(a, 100); //This is where we call the a() function for the first time
};
// ENDS TOP MENU FADE EFFECT