var boolFaceOn = "false";
var boolCopyOn = "false";
var boolChainsOn = "false";
var boolTombOn = false;
var bMuteSound = false;
var g_intLoop = 1;
var ver=parseInt(navigator.appVersion)
var ie4=(ver>3  && navigator.appName!="Netscape")?1:0
var ns4=(ver>3  && navigator.appName=="Netscape")?1:0
var ns3=(ver==3 && navigator.appName=="Netscape")?1:0

function LookupPostCode(varPC){
	try{
	document.getElementById("addressSelect").length=0;
	}catch(e){}
	parent.cmdWindow.location.href = 'LookupPostCode.asp?PostCode=' + varPC;	
}

function hideLookup(){
		document.getElementById("lookupDiv").style.display="none";
}

function SetPostCode(varAddress){
	try{
	var AddList = varAddress.split(",");

	document.getElementById("street").value = AddList[1] + AddList[2];
	document.getElementById("txtAddress3").value = AddList[3] + ' ' +AddList[4];
	document.getElementById("txtAddress4").value = AddList[5];
	document.getElementById("txtAddress5").value = AddList[6];
	document.getElementById("txtPostCode").value = AddList[7];}
	catch(e){}
}

function playSound(varSound) {

		if (bMuteSound){}else{
 if (ie4) document.all['BGSOUND_ID'].src=varSound;
 if (ie4) document.all['BGSOUND_ID'].loop=g_intLoop;}
}

function stopSound() {
	if (bMuteSound){
	document.all['BGSOUND_ID'].src='media/nosound.mp3';}else{
 if (ie4) document.all['BGSOUND_ID'].src='media/BGSound.mp3'; document.all['BGSOUND_ID'].loop=1000;}
}

function setMute(){
		if (bMuteSound){
				document.getElementById('mute').src="images/btn_mute_on.gif";
				bMuteSound = false;
		}else{
				document.getElementById('mute').src="images/btn_mute_off.gif";
				bMuteSound = true;
		}
		
		stopSound();
}

function aChangeFreegift(varObj){
	self.location.href="displaycart.asp?FG=" + varObj.value;
}

function startFace(){
	
	if(boolFaceOn == "false"){
		playSound('media/roar.mp3');
		document.getElementById('imgFace').src='images/face.gif';
		boolFaceOn = "true";
		setTimeout("stopFace()",6000);
	}
}

function stopFace(){
	boolFaceOn = "false";
	stopSound();
}



function startcopy(){
	if (boolCopyOn == "false"){
		document.getElementById('imgCopy').src='images/Copyright_animated.gif';
		document.getElementById('search').style.zIndex = '0';
		playSound('media/copyright.mp3');		
		boolCopyOn = "true";
		setTimeout("stopcopy()",4500);
	}
}

function startcog(){
		playSound('media/cog.mp3');
		document.getElementById('imgCog').src='images/cog_animated.gif';
		setTimeout("stopcog()",4500);
}

function stopcog(){
		document.getElementById('imgCog').src='images/cog_static.gif';
		stopSound();
}

function startTomb(){
		if(boolTombOn==false){
			playSound('media/tomb.mp3');
			boolTombOn=true;
			setTimeout("stopTomb()",2000);
		}
}

function stopTomb(){
		boolTombOn = false;
		stopSound();
}

function stopcopy(){
	boolCopyOn = "false";
	document.getElementById('search').style.zIndex = '2';
	stopSound();
}

function startchains(){
	if (boolChainsOn == "false"){
		g_intLoop = 4;
		playSound('media/chains.mp3');
		g_intLoop = 1;
		document.getElementById('imgChains').src='images/chains_animated.gif';
		boolChainsOn = "true";
		setTimeout("stopchains()",5000);
	}
}

function stopchains(){
		boolChainsOn = "false";
		stopSound();
}


function check_date(date){

	if (String(date).length == 0){
		return "ERROR";
	} else {
		return date;
	}
	

var checkstr = "0123456789";
var DateField = date;
var DateValue = date;
var DateTemp = "";
var seperator = ".";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var i;
   err = 0;
   /* Delete all chars except 0..9 */
   for (i = 0; i < DateValue.length; i++) {
	  if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
	     DateTemp = DateTemp + DateValue.substr(i,1);
	  }
   }
   
   DateValue = DateTemp;
   
   /* Always change date to 8 digits - string*/
   /* if year is entered as 2-digit / always assume 20xx */
   if (DateValue.length == 6) {
      DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
   if (DateValue.length != 8) {
      err = 19;}
   /* year is wrong if year = 0000 */
   year = DateValue.substr(4,4);
   if (year == 0) {
      err = 20;
   }
   /* Validation of month*/
   month = DateValue.substr(2,2);
   if ((month < 1) || (month > 12)) {
      err = 21;
   }
   /* Validation of day*/
   day = DateValue.substr(0,2);
   if (day < 1) {
     err = 22;
   }
   /* Validation leap-year / february / day */
   if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
      leap = 1;
   }
   if ((month == 2) && (leap == 1) && (day > 29)) {
      err = 23;
   }
   if ((month == 2) && (leap != 1) && (day > 28)) {
      err = 24;
   }
   /* Validation of other months */
   if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
      err = 25;
   }
   if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
      err = 26;
   }
   /* if 00 ist entered, no error, deleting the entry */
   if ((day == 0) && (month == 0) && (year == 00)) {
      err = 0; day = ""; month = ""; year = ""; seperator = "";
   }
   /* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
   
   if (err == 0) {
      DateField = day + seperator + month + seperator + year;
   }
   /* Error-message if err != 0 */
   else {
		DateField = "ERROR";
   }
   
   return DateField;
}


function checkForm(frm){
		var strMsg="";
		var objTemp;
		var strName;
		var strClass;
		var boolIsValid;
		
		boolIsValid=true
		
		for (var x=0; x < document.getElementById(frm).elements.length; x++){
				objTemp = document.getElementById(frm).elements[x]
				
				strName = objTemp.name;

				strClass = document.getElementById(strName).className;

				if(strClass.indexOf('mandatory') > -1){
						
						if(document.getElementById(strName).value==""){
							
							strMsg += document.getElementById(strName).title + " is a required field\n";
							
							boolIsValid=false;
						}
						
						//###CUSTOM CHECKING ON MANDATORY FIELDS
						if(strName=="txtPassword"){
								if(document.getElementById("txtPassword").value.length < 6){
										strMsg += "Password must be at least 6 characters long\n";
										
										boolIsValid = false;
								}
						}
						//###END CUSTOM CHECKING###
				}
				
				//###CUSTOM CHECKING BELOW###


				if(strName=="txtCustomerNotes"){
					if ((String(document.getElementById("txtCustomerNotes").value).length) > 255) {
						strMsg += "Notes cannot be more than 255 characters in lengh";
						boolIsValid = false;
					}
				}

				if(strName=="OrderUD1"){
					if ((String(document.getElementById("OrderUD1").value).length) > 255) {
						strMsg += "Special delivery instructions cannot be more than 255 characters in lengh";
						boolIsValid = false;
					}
				}


			if(strName=="txtEmail"){

				if (document.getElementById("txtEmail").value == ""){
				     boolIsValid = false;
				     strMsg += "Email is a required field\n";
				    }
				    
				    else {
						if (isValidEmail(document.getElementById("txtEmail").value)==false){
							 boolIsValid = false;
				  			 strMsg += "Invalid email address\n";
						}
						
						else {
							if (document.getElementById("txtEmail2").value == ''){
								boolIsValid = false;
								strMsg += "Please confirm your email\n";
							}
							
						}
					}	
					
					if (document.getElementById("txtEmail").value != document.getElementById("txtEmail2").value){
							boolIsValid = false;
							strMsg += "Email addresses must match\n";
						}

			}
			
			
			if(strName=="email"){

				if (document.getElementById("email").value == ""){
				     boolIsValid = false;
				     strMsg += "Email is a required field\n";
				    }
				    
				    else {
						if (isValidEmail(document.getElementById("email").value)==false){
							 boolIsValid = false;
				  			 strMsg += "Invalid email address\n";
						}
						
						else {
							if (document.getElementById("txtEmail2").value == ''){
								boolIsValid = false;
								strMsg += "Please confirm your email\n";
							}
							
						}
					}	
					
					if (document.getElementById("email").value != document.getElementById("txtEmail2").value){
							boolIsValid = false;
							strMsg += "Email addresses must match\n";
						}

			}



				if(strName=="txtPasswordConfirm"){
						if(document.getElementById("txtPassword").value != document.getElementById("txtPasswordConfirm").value){
								strMsg += "Passwords must match\n";
								
								boolIsValid = false;
						}
				}
				
				if(strClass.indexOf('date') > -1){
						var dateCheck = check_date(document.getElementById(strName).value);
						
						if(dateCheck=="ERROR"){
							strMsg += document.getElementById(strName).title + " is Invalid\n";
								
							boolIsValid = false;
						}else{
							document.getElementById(strName).value = dateCheck;
						}
				}
				//###END CUSTOM CHECKING###
		}
			
		
		if(boolIsValid == false){
				alert(strMsg);
				return false;
		}else{
			return true;
		}
}

var bMore = false;
var intSI = 0;
function clearopts(varItem){
	intSI = document.getElementById(varItem).selectedIndex;
	document.getElementById(varItem).length = 1;
}

function selectopts(varItem){
	document.getElementById(varItem).selectedIndex = intSI;
}

function CheckLoginForm(){
var sMsg="";
bFail = false;
    if (frmLogin.txtEmail.value == ""){
      bFail=true;
      sMsg=sMsg + "Email is a required field\n";
    }
    
    else {
		if (isValidEmail(document.getElementById("txtEmail").value)==false){
			bFail=true;
			sMsg=sMsg + "Invalid Email address\n";
		}
		
		else {
			if (document.getElementById("txtEmail2").value == ''){
				bFail = true; sMsg =sMsg + "Please confirm your email\n";
			}
			
		}
	}	
	
	if (document.getElementById("txtEmail").value != document.getElementById("txtEmail2").value){
			bFail = true; sMsg =sMsg + "Email addresses must match\n";
		}
    

    if (frmLogin.txtPassword.value == ""){
      bFail=true;
      sMsg=sMsg + "password is a required field\n";
    }

    if (frmLogin.txtPassword.value != frmLogin.txtPasswordConfirm.value){
      bFail=true;
      sMsg=sMsg + "Password's do not match\n";
    }
	
	if (frmLogin.txtPassword.value.length < 6){
      bFail=true;
      sMsg=sMsg + "Password must be at least 6 characters long\n";
    }


	if(bFail==true){
		alert(sMsg);
		return false;
	}else{
		return true;
	}


}

function ShowHideInitial(varObj){
if (varObj.cboTitle.value=='Other'){
    varObj.Initial1.style.display='none';
    divI.style.display='none';
    }else{
    varObj.Initial1.style.display='block';
    divI.style.display='block';
    }
}


function  ShowHideInitialD(varObj){
if (varObj.cboTitleD.value=='Other'){
    varObj.Initial1D.style.display='none';
    divI.style.display='none';
    }else{
    varObj.Initial1D.style.display='block';
    divI.style.display='block';
    }
}

function CheckPostReq(varObj)
{
    if (IgnoreCountry(varObj.value)==true){
    PostReq.style.display='none';
	document.getElementById('postCheck').value="false"
	}
    else{
   PostReq.style.display='inline';
   document.getElementById('postCheck').value="true"
	}
}


function Trim(TRIM_VALUE){
    if(TRIM_VALUE.length < 1){
    return"";
    }
    TRIM_VALUE = RTrim(TRIM_VALUE);
    TRIM_VALUE = LTrim(TRIM_VALUE);
    if(TRIM_VALUE==""){
    return "";
    }
    else{
    return TRIM_VALUE;
    }
} //End Function

function RTrim(VALUE){
    var w_space = String.fromCharCode(32);
    var v_length = VALUE.length;
    var strTemp = "";
    if(v_length < 0){
    return"";
    }
    var iTemp = v_length -1;

    while(iTemp > -1){
    if(VALUE.charAt(iTemp) == w_space){
    }
    else{
    strTemp = VALUE.substring(0,iTemp +1);
    break;
    }
    iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function



function allow_numeric(obj){
 if (/[^0-9]/i.test(obj.value))
  obj.value=obj.value.replace(/[^0-9]/g,'')
//  obj.value+=''
  obj.focus()
}

function allow_alpha(obj){
 if (/[^a-z]/i.test(obj.value))
  obj.value=obj.value.replace(/[^a-z]/gi,'')
//  obj.value+=''
  obj.focus()
}



function isValidEmail(str) {
   //return (str.indexOf(".") > str.indexOf("@")) && (str.indexOf("@") > 0);
   return (str.indexOf(".") > 0) && (str.indexOf("@") > 0);
}



function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789 ";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


function ShowMore(){

if (bMore==false){
	bMore=true;
	divSteps.style.display='block';
	more.innerText="<<";
}else{
	bMore=false;
	divSteps.style.display='none';
	more.innerText=">>";
}

}


function SendPageToFriend(){
	popUp('Emailafriend.asp?Page=' + location.href,"400","260","no");
}


function ChangeShippingOption(varVal){
	self.location.href="?SIP=" + varVal;
}

function popUp(URL,width,height,scroll){
	var settings
	settings = "width="+width+",height="+height+",scrollbars="+scroll+",toolbar=no";
	popwin = window.open(URL,"FAFSPORT",settings);
	popwin.focus();
}

	function EnsureSelection() {
		var bSel;
		try {
			bSel = false;
			if (document.CatReqList.CatalogueRequest){
				for (var i = 1; i<= document.CatReqList.CatalogueRequest.length; i++){
					if (document.CatReqList.CatalogueRequest[i-1].checked == true)	{
						bSel = true;
					}
				}
			}
			// do we have a valid selection
			if (bSel == true) {
				// ok to continue
				document.CatReqList.submit();
			} else {
				alert("Please select at least one catalogue to order");
			}
		} catch(e) {
			alert("EnsureSelection\n" + e.description);
		}
	}


function MakeDelAddressCard(frmObj){
	if(frmObj.chkSame.checked==true){
		frmObj.txtSurnameD.value=frmObj.txtName.value;
		frmObj.txtSurnameD.readOnly=true;
		frmObj.txtAddress1D.value=frmObj.txtAddress1.value;
		frmObj.txtAddress1D.readOnly=true;
		frmObj.txtAddress2D.value=frmObj.txtAddress2.value;
		frmObj.txtAddress2D.readOnly=true;
		frmObj.txtAddress3D.value=frmObj.txtAddress3.value;
		frmObj.txtAddress3D.readOnly=true;
		frmObj.txtAddress4D.value=frmObj.txtAddress4.value;
		frmObj.txtAddress4D.readOnly=true;
		frmObj.txtAddress5D.value=frmObj.txtAddress5.value;
		frmObj.cboCountryD.readOnly=true;
		frmObj.cboCountryD.value=frmObj.cboCountry.value;
		frmObj.cboCountryD.locked=true;
		frmObj.txtAddress5D.readOnly=true;
		frmObj.txtPostCodeD.value=frmObj.txtPostCode.value;
		frmObj.txtPostCodeD.readOnly=true;
		frmObj.txtTelephoneD.value=frmObj.txtTelephone.value;
		frmObj.txtTelephoneD.readOnly=true;
		frmObj.txtEmailD.value=frmObj.txtEmail.value;
		frmObj.txtEmailD.readOnly=true;
		frmObj.txtEmailD.value=frmObj.txtEmail.value;
		frmObj.txtEmailD.readOnly=true;
	}else{
		frmObj.txtSurnameD.disabled=false;
		frmObj.txtAddress1D.readOnly=false;
		frmObj.txtAddress2D.readOnly=false;
		frmObj.txtAddress3D.readOnly=false;
		frmObj.txtAddress4D.readOnly=false;
		frmObj.txtAddress5D.readOnly=false;
		frmObj.txtPostCodeD.readOnly=false;
		frmObj.cboCountry.readOnly=false;
		frmObj.cboCountry.locked=false;
		frmObj.txtTelephoneD.readOnly=false;
		frmObj.txtEmailD.readOnly=false;
		frmObj.txtEmailD.readOnly=false;
	}
	
	

}

function subSearch() {
	if ((document.Menu.C1.value== "") || (document.Menu.C2.value== "") ||(document.Menu.C3.value== "") || (document.Menu.C4.value== "")) {
		if (document.Menu.C1.value== "") {
			document.Menu.C1.value= 0;
		}
		if (document.Menu.C2.value== "") {
			document.Menu.C2.value= 0;
		}
		if (document.Menu.C3.value== "") {
			document.Menu.C3.value= 0;
		}
		if (document.Menu.C4.value== "") {
			document.Menu.C4.value= 0;
		}
		document.Menu.submit();
	// Dont process this one
	}
	else	{
		document.Menu.submit();
	}
}

function saveProduct(varOBJ){fraSaveItem.location.href="SaveProductLater.asp?ProductID=" + varOBJ.value + "&checked=" + varOBJ.checked;}
function ShowPrice(varObj, objPrice, Index){
		var PriceString;
		var intCount=1;
		PriceString=varObj.value.split("x"); 
		if (varObj.value != '')
		{ 
		objPrice.innerHTML=PriceString[4]; 
		document.getElementById("qty" + Index).readOnly=false;
		Index++;
		document.getElementById("fastCode" + Index).readOnly=false;

		}else{
			objPrice.innerHTML='';
			for(intCount;intCount<11;intCount++){
				document.getElementById("fastCode" + intCount).readOnly=true;
				document.getElementById("qty" + intCount).readOnly=true;
			}
			}
}    
function GetStock(varOBJ, intCount){if(varOBJ.value==''){return;}fraGetStock.location.href="LookUpStock.asp?PID="+ varOBJ.value + "&RowCount=" + intCount;}



function ValidateAddressFormD(frmObj){
	if (frmObj.nocheck=='1'){
		return true;
	}else{
	var bFail=false;
	var sMsg="";

	if (Trim(frmObj.Initial1D.value) == ""){
		bFail=true;
		sMsg=sMsg + "First Name is a required field\n";
	}

	if (Trim(frmObj.txtSurnameD.value) == ""){
		bFail=true;
		sMsg=sMsg + "Surname is a required field\n";
	}

	if (Trim(frmObj.txtAddress1D.value) == ""){
		bFail=true;
		sMsg=sMsg + "Address is a required field\n";
	}

	if (Trim(frmObj.txtAddress4D.value) == ""){
		bFail=true;
		sMsg=sMsg + "Town is a required field\n";
	}
	if (Trim(frmObj.txtAddress5D.value) == ""){
		bFail=true;
		sMsg=sMsg + "County is a required field\n";
	}
	if (frmObj.cboCountryD.value == ""){
		bFail=true;
		sMsg=sMsg + "Country is a required field\n";
	}
	if (Trim(frmObj.txtPostCodeD.value) == ""){
		if (IgnoreCountry(frmObj.cboCountryD.value)==false){
		bFail=true;
		sMsg=sMsg + "Post Code is a required field\n";
		}
	}
	if (Trim(frmObj.txtTelephoneD.value) == ""){
		bFail=true;
		sMsg=sMsg + "Telephone is a required field\n";
	}
	//if (IsNumeric(Trim(frmObj.txtTelephoneD.value)) == false){
		//bFail=true;
		//sMsg=sMsg + "Telephone number is invalid\n";
	//}
	if(bFail==true){
		alert(sMsg);
		return false;
	}else{
		return true;
	}}
}

function ValidateAddressForm(frmObj){
	if (frmObj.nocheck=='1'){
		return true;
	}else{
	var bFail=false;
	var sMsg="";

if (Trim(frmObj.Initial1.value) == ""){
		bFail=true;
		sMsg=sMsg + "First Name is a required field\n";
	}

	if (Trim(frmObj.txtSurname.value) == ""){
		bFail=true;
		sMsg=sMsg + "Surname is a required field\n";
	}

	if (Trim(frmObj.txtAddress4.value) == ""){
		bFail=true;
		sMsg=sMsg + "City is a required field\n";
	}
	if (Trim(frmObj.txtAddress5.value) == ""){
		bFail=true;
		sMsg=sMsg + "County is a required field\n";
	}
	if (frmObj.cboCountry.value == ""){
		bFail=true;
		sMsg=sMsg + "Country is a required field\n";
	}
	if (frmObj.cboCountry.value == ""){
		bFail=true;
		sMsg=sMsg + "Country is a required field\n";
	}
	if (Trim(frmObj.txtPostCode.value) == ""){
		if (IgnoreCountry(frmObj.cboCountry.value)==false){
		bFail=true;
		sMsg=sMsg + "Post Code is a required field\n";
		}
	}
	if (Trim(frmObj.street.value) == ""){
		bFail=true;
		sMsg=sMsg + "Street is a required field\n";
	}
	if (Trim(frmObj.number.value) == ""){
		bFail=true;
		sMsg=sMsg + "House Name/Number is a required field\n";
	}
	if (Trim(frmObj.txtTelephone.value) == ""){
		bFail=true;
		sMsg=sMsg + "Day Phone is a required field\n";
	}
	//if (IsNumeric(Trim(frmObj.txtTelephone.value)) == false){
		//bFail=true;
		//sMsg=sMsg + "Day Phone number is invalid\n";
	//}

	if (Trim(frmObj.txtEmail.value) == ""){
		bFail=true;
		sMsg=sMsg + "Email is a required field\n";
	}
	
	
	
	var dateCheck = check_date(frmObj.CustomerUD2.value);
	
	if(dateCheck=="ERROR"){
			bFail=true;
			sMsg=sMsg + "Date of Birth is invalid\n";
	}else{
			frmObj.CustomerUD2.value = dateCheck;
	}
	
	if(bFail==true){
		alert(sMsg);
		return false;
	}else{
		return true;
	}}
}

function ValidateCCForm(frmObj){
	var bFail=false;
	var sMsg="";
	
	if(document.getElementById("payment").style.display == "block"){
		if (document.getElementById("CreditCardNum").value == ""){
			bFail=true;
			sMsg = sMsg + "Credit Card Number is a required field\n";
		}
		if (document.getElementById("CardType").value == ""){
			bFail=true;
			sMsg = sMsg + "Credit Card Type is a required field\n";
		}
		if (document.getElementById("ValidToMonth").value == ""){
			bFail=true;
			sMsg = sMsg + "Valid To Month is a required field\n";
		}
		if (document.getElementById("ValidToYear").value == ""){
			bFail=true;
			sMsg = sMsg + "Valid To Year is a required field\n";
		}
		if (document.getElementById("CardSecurityCode").value == ""){
			bFail=true;
			sMsg = sMsg + "Security code is a required field\n";
		}
	}
	
	if(bFail==true){
		alert(sMsg);
		return false;
	}else{
		return true;
	}
}
function SelectAddress(strAddressLine, strSuffix){
	self.location.href="SelectAddress.asp?A=" + strAddressLine + "&Suffix=" + strSuffix;
}
//-->

function checkBuyForm(varObj){
 
if (varObj.ColourID.value==-1){
 alert("Please Choose your colour");
 return false;
}else{
 return true;
}
}

function cleropts(varOpts){
 //for (var x=varOpts.options.length -1; x > 0; x++)
 //{
 //  varOpts.options[x]=null;
 //}
}

/*Email validator*/
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){
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    return false
	}
	 if (str.indexOf(at,(lat+1))!=-1){
	    return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    return false
	 }
	 if (str.indexOf(dot,(lat+2))==-1){
	    return false
	 }
	 if (str.indexOf(" ")!=-1){
	    return false
	 }
	 return true					
}

function ValidateEmail(strString){
	var emailID=document.getElementById("txtEmail")
	
	if ((emailID.value==null)||(emailID.value=="")){
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.focus()
		return false
	}
	return true
 }
 
/*
function popUp(URL,width,height,scroll) {
 var settings
 settings = "width="+width+",height="+height+",scrollbars="+scroll+",toolbar=no";
 popwin = window.open(URL,"FAFSPORT",settings);
 popwin.focus();
}
 

var win = null;
 
function PopNew(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
 
 
*/