<!--
/*
start - Microsoft Virtual Earth - mapping code
used in the contact pages to generate live dynamic maps
*/


var map = null;
var pinID = 1;
var finding = false;

var mapaddress = '3131 S. Vaughn Way,Suite 134 Aurora, Colorado 80014, United States';
var maptitle = 'Actual Systems of America';

function GetMap(mapaddress,maptitle)
{
	map = new VEMap('myMap');
	
	//set default view to australia 
	try{	
	map.LoadMap(new VELatLong(0.0,0.0),10,'h');
	}catch(e){
	    //Browser does not support SGV or VML
	}	
	
		
	map.LoadMap();
	map.onLoadMap = FindLoc(mapaddress);
	map.AttachEvent("onchangeview", ViewChange);	
}

function addPushPin()
{
	//add pushpin of location
	var pin = new VEPushpin(pinID,map.GetCenter(),null,maptitle, mapaddress);
	map.AddPushpin(pin);
	pinID++;
}

function FindLoc()
{
	map.FindLocation(mapaddress);
	finding = true;
}


function FindCompleted()
{
	finding = false;
	addPushPin();
}

function ViewChange(e)
{
	if (finding)
	{
		FindCompleted();
	}
}


/*
end - Microsoft Virtual Earth - mapping code
used in the contact pages to generate live dynamic maps
*/


function bookmarksite(title, url){
	
	if (document.all)
	window.external.AddFavorite(url, title);
	else if (window.sidebar)
	window.sidebar.addPanel(title, url, "")

}

function toggleLayer( whichLayer ){
	var elem, vis;

  if( document.getElementById ) // this is the way the standards work

    elem = document.getElementById( whichLayer );

  else if( document.all ) // this is the way old msie versions work

      elem = document.all[whichLayer];

  else if( document.layers ) // this is the way nn4 works

    elem = document.layers[whichLayer];

  vis = elem.style;

  // if the style.display value is blank we try to figure it out here

  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)

    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';

  vis.display = (vis.display==''||vis.display=='block')?'none':'block';

}

	function showOptions(selectedOption){
	
		//hide all other options
		document.getElementById('feature1').style.display='none';
		document.getElementById('feature2').style.display='none';
		document.getElementById('feature3').style.display='none';
		document.getElementById('feature4').style.display='none';
		document.getElementById('feature5').style.display='none';
		
		//document.getElementById('hardwareDetails_a').className='';
		//document.getElementById('softwareDetails_a').className='';
		//document.getElementById('loginDetails_a').className='';
		//document.getElementById('routerDetails_a').className='';
			

		
		//show the one selected
		document.getElementById(selectedOption).style.display='block';
		document.getElementById(selectedOption+'_a').className='selected_lightblue';
																	
	}
	
	var CCNre = /^\s*\d(\d|\s)*$/;//regular expression for the credit card number field
	var EMAILre  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;//regular expression for the email address field
	 
	//generic re checker
	function genericTest(anyRE,title,stringToTest) {
		if(anyRE.test(stringToTest)) {
			return true;
		}else{
			return false;
		}
	}
	 
	//CHECK FIELDS FOR SPACES
	function spaces(elm) {
		if (elm.value.indexOf(" ") != "-1"){
			return true;
		}else {
			return false;
		}
	}
	 
	// CHECKS FOR BLANKS FIELDS
	function isfilled(elm) {
		if (elm.value=="" ||elm.value==null){
			return false;
		}else{
			return true;
		}
	}
	 
	function  checkPinnacleEasySignupForm(form){
	 
		var errorfields= "";//used to stored the error messages of the form
	 
		//NAME
		if (isfilled(form.contactName) == false){
			errorfields+="\n [+] Name not filled in";
		}
		//COMPANY NAME
		if (isfilled(form.companyName) == false){
			errorfields+="\n [+] Company Name not filled in";
		}
		
		//EMAIL
		if(genericTest(EMAILre,"useremail",form.email.value) == false) {
			errorfields+="\n [+] Email Address must be in the format someone@domainname.com";
		}
		
		//PHONE NUMBER
		/*if (isfilled(form.customer_phonenum) == false){
			errorfields+="\n [+] Phone Number not filled in";
		}*/
		
		
		return formattedFormFeedback(errorfields,'disable_yes');
		return true;
	}
	 
	function formattedFormFeedback(errorfields,disable_submit){
	 
		if (errorfields != "") {
			errorfields="The form contains an error/s or invalid information \n"+"________________________________________\n"+errorfields+"\n________________________________________\n"+"\nPlease enter correct information into the above fields.\n"+"\nAfter you have completed press Search again.\n";
			window.alert(errorfields);
			return false;
		}else{
		
			if (disable_submit == 'disable_yes'){
			//set elements to inform user of sending 
			//document.getElementById("submitmsg").innerHTML = "Sending Part Request Please wait <img src=\"http://www.autopartstrader.co.uk/images/loading_animation.gif\">";
			document.getElementById("submitmsg").style.display = 'block';
			document.getElementById('submit').disabled=true;
			}
			
		return true;
		}
	}
	
//-->
