﻿function load() {
var load = window.open('http://www.aimsmartbuilding.com/site/10mainstreetsouth/pop_notice1.htm','','scrollbars=no,menubar=no,height=300,width=300,resizable=no,toolbar=no,location=no,status=no');
}

function info() {
var load = window.open('http://www.aimsmartbuilding.com/pop_text/question_mark.htm','','scrollbars=no,menubar=no,height=250,width=300,resizable=no,toolbar=no,location=no,status=no');
}

function smartcode() {
var load = window.open('http://www.aimsmartbuilding.com/pop_text/smartcode.htm','','scrollbars=no,menubar=no,height=300,width=300,resizable=no,toolbar=no,location=no,status=no');
}

function notready() {
var load = window.open('http://www.aimsmartbuilding.com/pop_text/notready.htm','','scrollbars=no,menubar=no,height=300,width=300,resizable=no,toolbar=no,location=no,status=no');
}

function login()
	{
		var newWindow;
		var checkinfo=checklogindata();	//variable sets to false if error
		if(!checkinfo){return} //if error found return	
		//if all checks out OK, display report in new window
		if (!newWindow || newWindow.closed) 
		{
     		// newWindow = window.open("http://www.cttitlesearch.com/cttsreports/"+this.loginkey.value+".pdf","","height=400,width=600,location=no,resizable=yes,scrollbars=yes")
			
			if (this.loginkey.value =="")
			{
				alert("You must select your company name from the drop down list!");
				this.loginpanel.focus();
			}
			else if (this.loginkey.value =="top")
			{
			newWindow = window.open("http://www.turnpikeofficepark.com","_self")
			}	
			else if (this.loginkey.value =="500chase")
			{
			newWindow = window.open("http://www.500chase.com","_self")
			}
			else if (this.loginkey.value =="asbfee")
			{
			newWindow = window.open("http://www.aimsmartbuilding.com/pdf/ASB - License Fee Chart.pdf","_self")
			}
			else if (this.loginkey.value =="62commercial")
			{
			newWindow = window.open("http://www.62commercial.com","_self")
			}	
			else if (this.loginkey.value =="aimsmartbuilding")
			{
			newWindow = window.open("http://www.aimsmartbuilding.com","_self")
			}
			else if (this.loginkey.value =="10mainstreetsouth")
			{
			newWindow = window.open("http://www.aimsmartbuilding.com/site/10mainstreetsouth/panel.htm","_self")
			}	
			else if (this.loginkey.value =="junipers")
			{
			newWindow = window.open("http://www.aimdocuments.com/junipers","_self")
			}								
			else if (this.loginkey.value =="controls")
			{
			newWindow = window.open("http://www.aimwebsite.com/controls","_self")
			}	
			else if (this.loginkey.value =="kaliper")
			{
			newWindow = window.open("http://www.aimwebsite.com/aimdocuments/10mainstreetsouth/index.html","_self")
			}	
			else if (this.loginkey.value =="cast")
			{
			newWindow = window.open("http://www.aimsmartbuilding.com/site/cast/panel.htm","_self")
			}
			else if (this.loginkey.value =="henderson")
			{
			newWindow = window.open("http://www.aimwebsite.com/aimdocuments/henderson/","_self")
			}
			else if (this.loginkey.value =="aimstat")
			{
			newWindow = window.open("http://70.181.53.227:1024/","_self")
			}	
			else if (this.loginkey.value =="dramonitor")
			{
			newWindow = window.open("http://69.182.82.201/","","height=168,width=640,location=no,resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no")
			}	
			else if (this.loginkey.value =="500tower")
			{
			newWindow = window.open("http://www.aimwebsite.com/500tower/","_self")
			}																																																								
			else
			{
			alert("The LOGIN ID you entered is invalid. Please try again or contact an AIM representative for assistance.")
			}	
	
		}	
		
	}
	

function checklogindata() //v1.0
	{
		if (this.loginkey.value =="")
		{
			alert("You must enter a LogIn ID number.\nPlease enter your correct ID code and try again");
			this.loginkey.focus();
			var IsFormValid = false;
			return IsFormValid;
		}
		valuetocheck = this.loginkey.value;
		myRegExp = /[a-zA-Z0-9][0-9a-zA-Z]{2,18}/;
		IsFormValid = myRegExp.test(valuetocheck);
		if (!IsFormValid) 				
		{
			alert("The Login ID code you entered is not a correct format.\nPlease check yourLogin ID code and try again.");
			IsFormValid = false;
			this.loginkey.focus();
			return IsFormValid;
		}	
		IsFormValid = true;
		return IsFormValid;
	}



function getsearch()
	{
		var newWindow;
		var checkinfo=searchdata();	//variable sets to false if error
		if(!checkinfo){return} //if error found return	
		//if all checks out OK, display report in new window
		if (!newWindow || newWindow.closed) 
		{
     		// newWindow = window.open("http://www.cttitlesearch.com/cttsreports/"+this.loginkey.value+".pdf","","height=400,width=600,location=no,resizable=yes,scrollbars=yes")
			
			if (this.lookfor.value =="")
			{
				alert("You must enter a term or word first!");
				this.lookfor.focus();
			}
			else if (this.lookfor.value =="smart")
			{
			newWindow = window.open("http://www.aimsmartbuilding.com","_self")
			}	
			else if (this.lookfor.value =="500")
			{
			newWindow = window.open("http://www.500chase.com","_self")
			}	
			else if (this.lookfor.value =="commercial")
			{
			newWindow = window.open("http://www.62commercial.com","_self")
			}	
			else if (this.lookfor.value =="internet")
			{
			newWindow = window.open("http://www.websbyaim.com","_self")
			}	
			else if (this.lookfor.value =="brit")
			{
			newWindow = window.open("http://www.aimwebsite.com/brit","_self")
			}	
			else if (this.lookfor.value =="derekletter")
			{
			newWindow = window.open("http://www.aimwebsite.com/derekletter.htm","_self")
			}	
			else if (this.lookfor.value =="website")
			{
			newWindow = window.open("http://www.websbyaim.com","_self")
			}							
			else
			{
			alert("The word you entered was not located in our database. This is a private access search portal. Please visit any of our websites for additional information or try using a public search engine to find information on your term.")
			}	
	
		}	
		
	}
	

function searchdata() //v1.0
	{
		if (this.lookfor.value =="")
		{
			alert("You must enter one word or term describing what you are looking for");
			this.lookfor.focus();
			var IsFormValid = false;
			return IsFormValid;
		}
		valuetocheck = this.lookfor.value;
		myRegExp = /[a-zA-Z0-9][0-9a-zA-Z]{2,18}/;
		IsFormValid = myRegExp.test(valuetocheck);
		if (!IsFormValid) 				
		{
			alert("Please enter one word, no spaces describing what you are looking for");
			IsFormValid = false;
			this.lookfor.value =""
			this.lookfor.focus();
			return IsFormValid;
		}
		IsFormValid = true;
		return IsFormValid;
	}


