var tmr;
var t;
var obj;

function sFa() {
	obj = gObj();
	sLft();
	sTop();
	shw(true);
	t = 0;
	sTmr();
	obj.style.display="block";
}

function hFa() {
	t = -100;
	sTmr();
	return false;
}

function sTmr() {
	tmr = setInterval("fd()",20);
}

function fd() {
	var amt = Math.abs(t+=10);
	if(amt == 0 || amt == 100) clearInterval(tmr);
	amt = (amt == 100)?99.999:amt;

	obj.style.filter = "alpha(opacity:"+amt+")";
	obj.style.KHTMLOpacity = amt/100;
	obj.style.MozOpacity = amt/100;
	obj.style.opacity = amt/100;

	if(amt == 0) shw(false);
}

function sLft() {
	//var w = 160;	// set this to 1/2 the width of the fa div defined in the style sheet
	var w = 188;	// set this to 1/2 the width of the fa div defined in the style sheet
			// there's not a reliable way to retrieve an element's width via javascript!!

	//var l = (document.body.innerWidth)? document.body.innerWidth / 2:document.body.offsetWidth / 2;
	var l = 390;

	obj.style.left = (l - w)+"px";
}

function sTop() {
	//var l = (document.body.innerWidth)? document.body.innerWidth / 2:document.body.offsetWidth / 2;
	var l = 390;

	var height = window.document.body.clientHeight;

//	window.alert(height);
	obj.style.top = (height/2-150)+"px";
}

function gObj() {
	return document.getElementById("fa");
}

function shw(b) {
	(b)? obj.className = 'show':obj.className = '';
}

/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true
	}

function ValidateForm(){
	var emailID=document.frmEmailSubscribe.email

	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email Address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	document.frmEmailSubscribe.submit()
 }


 function FaChangeInput(obj){
 	obj.value=''
 	obj.style.color='#000000'
 }
