function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function strToLower(str) {
	ltext = document.getElementById(str).value
	casechanged=ltext.toLowerCase()
	document.getElementById(str).value = casechanged;
}

function strTrim(str) {
var elem = document.getElementById(str).value;
document.getElementById(str).value = elem.replace(/^\s+|\s+$/g, '');
}

function strProperCase(str) {
var elem = document.getElementById(str).value;
document.getElementById(str).value = elem.toLowerCase().replace(/^(.)|\s(.)/g, function($1) { return $1.toUpperCase(); });
}

function echeck() {

		var emailID=document.getElementById("from");
		var at="@";	
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (emailID.indexOf(at)==-1){
			alert("Invalid E-mail address");
			emailID.focus();
			return false;
		}

		if (emailID.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		 	alert("Invalid E-mail address");
			emailID.focus();
		 	return false;
		}

		if (emailID.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail address");
			emailID.focus();
		    return false;
		}

		 if (emailID.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail address");
			emailID.focus();
		    return false;
		 }

		 if (emailID.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail address");
			emailID.focus();
		    return false;
		 }

		 if (emailID.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail address");
			emailID.focus();
		    return false;
		 }
		
		 if (emailID.indexOf(" ")!=-1){
		    alert("Invalid E-mail address");
			emailID.focus();
		    return false;
		 }
 		 return true;					
}

function ValidateForm(){
	var emailID=document.getElementById("from");
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email address");
		fnemailfocus();
		return false;
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		fnemailfocus();
		return false;
	}
	return true;
 }

function fnValidateForm() {
	if ((document.register.name.value == "") || (document.register.from.value == "")) {
		alert("To receive your free* body wraps, please fill out all fields in the form provided.");
		document.register.name.focus();
		return false;
	} else {
		document.getElementById("register").submit();
		return true;
	}
}

function fnemailfocus() {
		document.register.from.focus();
}

function setfocus() {
		document.register.name.focus();
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
