// JavaScript Document
function echeck(str){ //Check email address
	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 ID")
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail ID")
	   return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    alert("Invalid E-mail ID")
	    return false
	}
	 if (str.indexOf(at,(lat+1))!=-1){
	    alert("Invalid E-mail ID")
	    return false
	 }
	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    alert("Invalid E-mail ID")
	    return false
	 }
	 if (str.indexOf(dot,(lat+2))==-1){
	    alert("Invalid E-mail ID")
	    return false
	 }
	 if (str.indexOf(" ")!=-1){
	    alert("Invalid E-mail ID")
	    return false
	 }
 	return true					
}

function checkfrm(){
	var name  = document.quote.name;
	var email  = document.quote.email;
	var phone = document.quote.phone;
	var type = document.quote.type;
	var property = document.quote.property;
	var iam = document.quote.iam;
	var ftype = document.quote.ftype;
	if((name.value=="")||(name.value==null)||(name.value=="name")){
		alert("Please enter your name!");
		name.value="";
		name.focus();
		return false;
	}else if ((email.value==null)||(email.value=="")){
		alert("Please enter your E-mail ID!");
		email.focus()
		return false
	}else if(echeck(email.value)==false){
		email.value="";
		email.focus();
		return false		
	}else if((phone.value=="")||(phone.value==null)||(phone.value=="phone")){
		alert("Please enter your phone number!");
		phone.value="";
		phone.focus();
		return false;	
	}else if(type.value==0){
		alert("Please select type of service!");
		return false;
	}else if(property.value==0){
		alert("Please select property!");
		return false;
	}else if(iam.value==0){
		alert("Please select I am!");
		return false;
	}else if(ftype.value==0){
		alert("Please select foundation type!");
		return false;
	}
	return true;
}

function clears(id,str,val){

		if(val == 0 && document.getElementById(id).value == str) document.getElementById(id).value="";

		else if(val ==1 && document.getElementById(id).value == "") document.getElementById(id).value=str;

}

function jump(){

	window.location.href='#quote';

	document.getElementById('name').focus();

}



function changeVideo(video,links){

	var videoPlace = document.getElementById('videoPlace');

	var videoLinks = document.getElementById(links);

	if(videoPlace != null) {

		videoPlace.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="272" id="Overview" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">' +

		'<param name="allowScriptAccess" value="sameDomain" />' +

		'<param name="src" value="swf/player.swf" />' +

		'<param name="menu" value="false" />' +

		'<param name="FlashVars" value="videoUrl=../videos/'+video+'" />' +

		'<embed type="application/x-shockwave-flash" width="480" height="272" menu="false" src="swf/player.swf" FlashVars="videoUrl=../videos/'+video+'" allowScriptAccess="sameDomain"></embed>' +

		'</object>';

		document.getElementById('video1').className="";

		document.getElementById('video2').className="";

		document.getElementById('video3').className="";

		videoLinks.className="current";

	}

}



function frmVal(name,val,str){

	if(val == 0){

		if(document.getElementById(name).value == str){

			document.getElementById(name).value  = '';

		}

	} else if(val == 1){

		if(document.getElementById(name).value == ''){

			document.getElementById(name).value = str;

		}

	}

}

