// JavaScript Document  
var count = 1;  
function fnGetDomain(url) {  
	//alert(url);  
   var url1 = url.match (/:\/\/(.[^/]+)/)[1];  
   return url1;  
}  
function set_cookie( c_name, value )  
{  
	var expires ="";  
	domain ="laurels.com";  
	document.cookie = c_name + "=" +escape(value) +  "; domain="+ escape(domain) +";" + expires ;  
	if(document.cookie)  
	{  
		return 1;  
	}  
	else  
	{  
		return 0;  
	}  
}  
function get_cookie ( c_name )  
{  
  var results = document.cookie.match ( '(^|;) ?' + c_name + '=([^;]*)(;|$)' );  
if ( results )  
    return ( unescape ( results[2] ) );  
  else  
    return null;  
}  
function delete_cookie ( cookie_name )  
{  
  var cookie_date = new Date ( );  // current date & time  
  cookie_date.setTime ( cookie_date.getTime() - 1 );  
  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();  
}  
function loadXMLDoc(url)  
{  
	//alert("URL  "+url);  
	head_url = url + "header.txt";  
	button_url = url + "buttons01.txt";  
	foot_url = url + "footer.txt";  
	fill_url = url + "fill.gif";  
	if (window.XMLHttpRequest)  
	  {// code for IE7+, Firefox, Chrome, Opera, Safari  
		  xmlhttp=new XMLHttpRequest();  
	  }  
	else  
	  {// code for IE6, IE5  
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");  
	  }  
	xmlhttp.open("GET",head_url,false);  
	xmlhttp.send(null);  
	document.getElementById('header').innerHTML = xmlhttp.responseText;  
	//alert("head url "+head_url);  
	xmlhttp.open("GET",foot_url,false);  
	xmlhttp.send(null);  
	document.getElementById('footer').innerHTML = xmlhttp.responseText;  
	document.getElementById('but').style.backgroundImage = "url(" + fill_url + ")";  
}  
  	var distributors = new Array();  
	distributors[0] = "newark" ;  
	distributors[1] = "sensorguys";  
	distributors[2] = "flw";  
	distributors[3] = "thermx";  
	distributors[4] = "calcert";  
	distributors[5] = "sml-inc";  
	distributors[6] = "tanyx";  
	distributors[7] = "byramlabs";  
	distributors[8] = "spectrumind";  
	distributors[9] = "pc-s";  
	distributors[10] = "a-aelectric";  
	distributors[11] = "weionline";  
	distributors[12] = "weschler";  
	distributors[13] = "instrumentation";  
	distributors[14] = "advindsys";  
	distributors[15] = "alphasystemspr";  
	distributors[16] = "davis";  
	distributors[17] = "dalec";  
	distributors[18] = "coleparmer";  
	distributors[19] = "iiiinc";  
	distributors[20] = "tec-hackett";  
	distributors[21] = "autoctrls";  
	distributors[22] = "durablecontrols";  
	distributors[23] = "eminstrumentswi";  
	distributors[24] = "cromptonwesterncanada";  
	distributors[25] = "mcl";  
	distributors[26] = "crompton-canadaeast";  
	distributors[27] = "ams-ic";  
	distributors[28] = "alphasystemspr";  
	distributors[29] = "pile";  
	distributors[30] = "sunbees";  
	distributors[31] = "tmgp";  
	distributors[32] = "usconsultancyservices";  
	distributors[33] = "exceltec-inc";  
	distributors[34] = "processmeasurementco";  
	distributors[35] = "flwleightonstone";  
	distributors[36] = "psi-flw";  
	distributors[37] = "peachstateinstruments";  
	distributors[38] = "metersales"; 
	distributors[39] = "branom";
	distributors[40] = "rammeter"; 
	distributors[41] = "metershop";
	distributors[42] = "cromptoncanada";
	distributors[43] = "laurels";  

	var dist_name = new Array();  
	dist_name[0] = "Newark Services";  
	dist_name[1] = "D&D Engineeering (Southern CA)";  
	dist_name[2] = "FLW, Inc.(Southern CA)";  
	dist_name[3] = "Therm-X Southwest (Southern CA)";  
	dist_name[4] = "Wilmington Instrument Company (Southern CA)";  
	dist_name[5] = "Standard Meter Labs, Inc. (Northern CA)";  
	dist_name[6] = "Tanyx Measurements, Inc.";  
	dist_name[7] = "Byram Laboratories Inc.";  
	dist_name[8] = "Spectrum Industries";  
	dist_name[9] = "Panel Components & Systems, Inc.";  
	dist_name[10] = "AA Electric";  
	dist_name[11] = "WEI, Inc.";  
	dist_name[12] = "Weschler Instruments";  
	dist_name[13] = "Instrumentation.Com / Shelby Jones Co.";  
	dist_name[14] = "Advanced Industrial System, Inc.";  
	dist_name[15] = "Caribbean: Alpha Systems";  
	dist_name[16] = "Davis Instruments";  
	dist_name[17] = "Dalec Electronics, Inc.";  
	dist_name[18] = "Cole-Parmer";  
	dist_name[19] = "Interstate Industrial Instrumentation, Inc.";  
	dist_name[20] = "Tec-Hackett, Inc.";  
	dist_name[21] = "Automatic Controls Co.";  
	dist_name[22] = "Durable Controls, Inc.";  
	dist_name[23] = "E-M Instruments";  
	dist_name[24] = "Crompton Western Canada, Inc.";  
	dist_name[25] = "Measurement & Controls Ltd.";  
	dist_name[26] = "Crompton Technology";  
	dist_name[27] = "AMS Instrumentation & Calibration Pty Ltd.";  
	dist_name[28] = "Alpha Systems";  
	dist_name[29] = "Soil Dynamics SDN BHD";  
	dist_name[30] = "Sun-Bee Instruments, Inc";  
	dist_name[31] = "TMGP";  
	dist_name[32] = "US Consultancy Services";  
	dist_name[33] = "Exceltec, Inc.";  
	dist_name[34] = "Process Measurement Company";  
	dist_name[35] = "FLW Leightonstone";  
	dist_name[36] = "Process Specialities, Inc.";  
	dist_name[37] = "Peach State Instruments";  
	dist_name[38] = "Instrument Meter Specialties (Southern CA)";  
	dist_name[39] = "Branom Instrument Co.";  
	dist_name[40] = "Ram Meter, Inc.";  
	dist_name[41] = "The Meter Shop";  
	dist_name[42] = "Crompton Technology";  
	var address = new Array();  

	address[0] = "6150 West Chandler Blvd., Suite 38,Chandler, AZ 85226";  
	address[1] = "19355 Business Center Drive, Suite 2, Northridge, CA 91324" ;  
	address[2] = "5672 Bolsa Ave., Huntington Beach, CA 92649";  
	address[3] = "7370 Opportunity Road, Suite S, San Diego, CA 92111";  
	address[4] = "332 N. Fries Ave.,Wilmington, CA 90744";  
	address[5] = "236 Rickenbacker Circle, Livermore, CA 94550";  
	address[6] = "505 Middlesex Turnpike, Billerica, MA 01821";  
	address[7] = "1 Columbia Road, Branchburg, NJ 08876";  
	address[8] = "145 Summit Street, Unit 4, Peabody, MA 01960";  
	address[9] = "149 Main St., Stanhope,  NJ 07874";  
	address[10] = "1 Madison Street, East Rutherford, NJ 07073";  
	address[11] = "107 Baker Street, Syracuse, NY 13206";  
	address[12] = "16900 Foltz Parkway, Cleveland OH 44149";  
	address[13] = "8800 West Chester Pike, Upper Darby, PA 19082";  
	address[14] = "4004 Harrods Landing Dr., Prospect, KY 40059";  
	address[15] = "#1353 Rd. 19, Suite 203, Guaynabo, Puerto Rico 00966";  
	address[16] = "3817 NW Wagon Wheel Road, Piedmont, OK 73078";  
	address[17] = "9335 W. Belmont Ave., Franklin Park,  IL 60131";  
	address[18] = "625 E. Bunker Court, Vernon Hills, IL 60061";  
	address[19] = "974 - 73rd Street, Suite #1, Des Moines,  IA 50312";  
	address[20] = "3418 Cavalier Drive, Fort Wayne,  IN 46808";  
	address[21] = "50220 Dennis Court, Wixom, MI 48393";  
	address[22] = "515 Industrial Drive, PO Box 409, Hartland, WI 53029";  
	address[23] = "3712 W. Elm Street, Milwaukee, WI 53209";  
	address[24] = "#125, 11769 - 40th Street, S.E., Calgary, Alberta T2Z 4M8, Canada";  
	address[25] = "Unit # 1, 2916 5th Avenue NE, Calgary, AB T2A 6K4, Canada";  
	address[26] = "7544 Bath Road, Mississauga, Ontario L4T 1L2, Canada";  
	address[27] = "Unit 17, 87-91 Heatherdale Road., Ringwood, Victoria, 3134, Australia";  
	address[28] = "#1353 Rd. 19, Suite 203, Guaynabo,Puerto Rico 00966";  
	address[29] = "19 Jalan TPP 1/10, Taman Industrial Puchong, Puchong Selango, Malaysia";  
	address[30] = "501, Cintree Techno Town, 1254 SinJeon-Dong YanCheon-Gu, Seoul 158-073, Korea";  
	address[31] = "4911 Royce Road Irvine, CA 92612, USA";  
	address[32] = "Arya Nagar Kanpur";  
	address[33] = "2100 Francis-Hughes, Laval, Quebec H7S 1N7, Canada";  
	address[34] = "2475 West Second Avenue, Denver, CO 80223";  
	address[35] = "258 A Bel Marin Keys Blvd- Novato, CA- 94949";  
	address[36] = "7000 E. 47th Avenue Unit 800 Denver, CO 80216";  
	address[37] = "869-I Pickens Industrial Drive, Marietta, GA 30063";  
	address[38] = "2108 B West Magnolia Blvd., Burbank, CA 91506";  
	address[39] = "5500 - 4th Ave. S, Seattle, WA 98108";  
	address[40] = "1903 Barrett Drive, Troy, MI 48084";  
	address[41] = "4202 Directors Row # 100, Houston, TX 77092";  
	address[42] = "7544 Bath Road, Mississauga, Ontario L4T 1L2, Canada";  

	var phone = new Array();  
	phone[0] = "877-214-2195";  
	phone[1] = "877-232-7185";  
	phone[2] = "877-233-1822";  
	phone[3] = "877-260-4484";  
	phone[4] = "877-261-4332";  
	phone[5] = "877-262-1006";  
	phone[6] = "877-271-6487";  
	phone[7] = "877-278-3294";  
	phone[8] = "877-277-0845";  
	phone[9] = "877-281-2630";  
	phone[10] = "877-290-9614";  
	phone[11] = "877-300-2027";  
	phone[12] = "877-318-1265";  
	phone[13] = "877-303-7651";  
	phone[14] = "877-324-4901";  
	phone[15] = "877-337-5122";  
	phone[16] = "877-343-0732";  
	phone[17] = "877-393-3902";  
	phone[18] = "877-398-8443";  
	phone[19] = "877-425-2113";  
	phone[20] = "877-440-6628";  
	phone[21] = "877-462-5009";  
	phone[22] = "877-476-8266";  
	phone[23] = "877-478-1454";  
	phone[24] = "877-546-1209";  
	phone[25] = "877-595-2220";  
	phone[26] = "877-625-7292";  
	phone[27] = "[61] (0)3-9872 6121, Free call NZ: 0800 442 743";
	phone[28] = "787-787-7663"; 
	phone[29] = "603-8060-4450";  
	phone[30] = "[82] 22605-5100"; 
	phone[31] = "(949) 786-1403";  
	phone[32] = "";  
	phone[33] = "(888)266-4559"; 
	phone[34] = "(866)495-7102"; 
	phone[35] = "(866)570-6221"; 
	phone[36] = "(866)270-7121";
	phone[37] = "(866)791-2814"; 
	phone[38] = "(866)634-2896";
	phone[39] = "800-767-6051"; 
	phone[40] = "888-484-4224";  
	phone[41] = "713-957-8586"; 
	phone[42] = "877-625-7292"; 	

	var fax = new Array();  
	fax[0] = "480-820-1533"; 
	fax[1] = "818-772-2477"; 
	fax[2] = "714-751-0213"; 
	fax[3] = "858-573-0623"; 
	fax[4] = "310-843-6527"; 
	fax[5] = "925-449-1704"; 
	fax[6] = "978-663-5223"; 
	fax[7] = "908-252-0822"; 
	fax[8] = "978-532-4214"; 
	fax[9] = "973-448-1674"; 
	fax[10] = "973-773-1193";
	fax[11] = "315-437-4296";
	fax[12] = "";  
	fax[13] = "610-449-7010";
	fax[14] = "502-228-0127";
	fax[15] = "787-792-4294";
	fax[16] = "800-433-9971";
	fax[17] = "847-671-7665";
	fax[18] = "847-247-2929";  
	fax[19] = "515-225-1511";  
	fax[20] = "471-7309";  
	fax[21] = "248-624-8383";  
	fax[22] = "262-367-8695";  
	fax[23] = "414-247-1365";  
	fax[24] = "403 257-6657";  
	fax[25] = "654789465";  
	fax[26] = "";  
	fax[27] = "[61] (0)3-9872 6131"; 
	fax[28] = "787-792-4294";  
	fax[29] = "603-8064-1630";  
	fax[30] = "[82] 22065-8222";  
	fax[31] = "";  
	fax[32] = "";  
	fax[33] = "888-238-0849";  
	fax[34] = "303-936-2731";  
	fax[35] = "(415) 382 - 9720";  
	fax[36] = "";  
	fax[37] = "770-424-0465";  
	fax[38] = "818-841-2379";  
	fax[39] = "206-767-5669";  
	fax[40] = "248-362-1818";  
	fax[41] = "713-957-8587";  
	fax[42] = "";  
	var path = new Array();  
	path[0] = "include_newark/";  
	path[1] = "include_sensorguys/";  
	path[2] = "include_flw/";  
	path[3] = "include_thermx/";  
	path[4] = "include_wilmington/";  
	path[5] = "include_sml/";  
	path[6] = "include_tanyx/";  
	path[7] = "include_byram/";  
	path[8] = "include_spectrum/";  
	path[9] = "include_pc-s/";  
	path[10] = "include_aaelectric/";  
	path[11] = "include_weionline/";  
	path[12] = "include_weschler/";  
	path[13] = "include_laurels/";  
	path[14] = "include_advindsys/";  
	path[15] = "include_laurels/";  
	path[16] = "include_davis/";  
	path[17] = "include_dalec/";  
	path[18] = "include_coleparmer/";  
	path[19] = "include_iiiinc/";  
	path[20] = "include_tec/";  
	path[21] = "include_autoctrls/";  
	path[22] = "include_durablecontrols/";  
	path[23] = "include_em/";  
	path[24] = "include_cromptonwestern/";  
	path[25] = "include_mcl/";  
	path[26] = "include_crompton_east/";  
	path[27] = "include_laurels/";  
	path[28] = "include_laurels/";  
	path[29] = "include_laurels/";  
	path[30] = "include_laurels/";  
	path[31] = "include_tmgp/";  
	path[32] = "include_laurels/";  
	path[33] = "include_exceltec/";  
	path[34] = "include_pmc/";  
	path[35] = "include_leightonstone/";  
	path[36] = "include_psiflw/";  
	path[37] = "include_peach/";  
	path[38] = "include_metersales/";  
	path[39] = "include_branom/";  
	path[40] = "include_rammeter/";  
	path[41] = "include_metershop/";  
	path[42] = "include_crompton_east/"; 
	
	var dist_mail = new Array();  
	
	dist_mail[0] = "raugustyniak@newark.com";  
	dist_mail[1] = "sales@sensorguys.com";  
	dist_mail[2] = "thien@flw.com";  
	dist_mail[3] = "sales@thermx.com";  
	dist_mail[4] = "sales@calcert.com";  
	dist_mail[5] = "rj@sml-inc.com";  
	dist_mail[6] = "robert.kieser@verizon.net";  
	dist_mail[7] = "sales@byramlabs.com";  
	dist_mail[8] = "www.spectrumind.com";  
	dist_mail[9] = "www.pc-s.com";  
	dist_mail[10] = "gasales@a-aelectric.com";  
	dist_mail[11] = "rfowler@weionline.com";  
	dist_mail[12] = "info@weschler.com";  
	dist_mail[13] = "mike@instrumentation.com";  
	dist_mail[14] = "sales@advindsys.com";  
	dist_mail[15] = "alpha01@prtc.net";  
	dist_mail[16] = "sales@davis.com";  
	dist_mail[17] = "sales@dalec.com";  
	dist_mail[18] = "";  
	dist_mail[19] = "kurtn@iiiinc.com";  
	dist_mail[20] = "tammy@tec-hackett,com";  
	dist_mail[21] = "sales@autoctrls.com";  
	dist_mail[22] = "sales@durablecontrols.com";  
	dist_mail[23] = "eminstruments@sbcglobal.net";  
	dist_mail[24] = "chriss@cromptonwci.com";  
	dist_mail[25] = "rramessar@mcl.ca";  
	dist_mail[26] = "info@crompton-canadaeast.com";  
	dist_mail[27] = "";  
	dist_mail[28] = "";  
	dist_mail[29] = "";  
	dist_mail[30] = "";  
	dist_mail[31] = "hweiss@tmgp.com";  
	dist_mail[32] = "ussoftware.services@gmail.com";  
	dist_mail[33] = "danny@exceltec-inc.com";  
	dist_mail[34] = "sales@processmeasurementco.com";  
	dist_mail[35] = "orderdesk@leightonstone.com";  
	dist_mail[36] = "sales@psidenver.com";  
	dist_mail[37] = "jack@peachstateinstruments.com";  
	dist_mail[38] = "sales@metersales.com";  
	dist_mail[39] = "sales@branom.com";  
	dist_mail[40] = "sales@rammeter.com";  
	dist_mail[41] = "dale@metershop.com";  
	dist_mail[42] = "info@crompton-canadaeast.com";  

function select_ref()  
{  
var ref = document.referrer;  
//alert("Referrer is "+ ref);  
if(ref.match("cx=002792931191173719256")=="cx=002792931191173719256")  
{  
	//alert("found from custom search");  
	var stat = get_cookie("status");  
	if(stat == 1)  
	{  
		i = get_cookie("ref_path");  
		loadXMLDoc(i);  
	}  
	else  
	{  
		i="include_laurel/";  
		loadXMLDoc(i);  
	}  
}  
else  
{  
	if(ref=="")  
	{  
		var stat = get_cookie("status");  
		if(stat == 1)  
		{  
			i = get_cookie("ref_path");  
			loadXMLDoc(i);  
		}  
		else  
		{  
			i="include_laurel/";  
			loadXMLDoc(i);  
		}  
	}  
	else  
	{  
		var domain = fnGetDomain(ref);  
	}  
}  
	var x = domain.search("www.");  
	if(x == 0)  
	{  
	var dom = domain.slice(4);  
	}  
	else  
	{  
	var dom = domain;  
	}  
var i=dom.indexOf(".");  
var dom2=dom.slice(0,i);  
 //alert("Last domain " +dom2);  
var flag = 0;  
if(dom2 == "laurels")    					     
{  
	index = 43;                  //index of laurels in distributors array  
	var stat = get_cookie("status");  
	if(stat == 1)  
	{  
		var i = get_cookie("ref_path");  
		loadXMLDoc(i);  
	}  
	else  
	{  
		var i = "include_laurel/";  
		loadXMLDoc(i);  
	}  
}  
else  
{  
	for(var x = 0; x<distributors.length; x++)  
	{  
		if(dom2 == distributors[x])  
		{  
			 var flag = 1;  
			 var temp = x;  
			 break;  
		}  
	}  
	if(flag ==1)  
	{  
		var index = temp;  
	}  
	else  
	{  
		index = -1;  
	}  
}  
		if(index!=-1)  
		{  
			if(index == 43)           //index of laurels in distributors array  
			{  
				var stat = get_cookie("status");  
				if(stat == 1)  
				{  
					var i = get_cookie("ref_path");  
					loadXMLDoc(i);  
				}  
				else  
				{  
					i ="include_laurel/";  
					loadXMLDoc(i);  
				}  
			}  
			else  
			{  
			/*  
				if(index==2)  
				{  
				alert("Height is "+document.getElementById('header').style.height);  
				document.getElementById('header').style.height = 1000;  
				alert("Height is "+document.getElementById('header').style.height);  
				cookie_work(index);  
				//alert("Index " +index);  
				set_cookie("status","1");  
				}  
				else  
				{*/  
				cookie_work(index);  
				//alert("Index " +index);  
				set_cookie("status","1");  
				//}  
			}  
		}  
		if(index == -1)  
		{  
			var i = "include_laurel/";  
			delete_cookie("dist_name");  
			delete_cookie("address");  
			delete_cookie("phone");  
			delete_cookie("fax");  
			delete_cookie("dist_mail");  
			delete_cookie("url");  
			loadXMLDoc(i);  
			set_cookie("status","0");  
		}  
 function cookie_work(index_do)  
  	{  
			//alert("index in function is "+index_do);  
			//alert("path in function is "+path[index_do]);  
  			set_cookie("dist_name","" + dist_name[index_do] + "");  
			set_cookie("address","" + address[index_do] + "");  
			set_cookie("phone","" + phone[index_do] + "");  
			set_cookie("fax","" + fax[index_do] + "");  
			set_cookie("dist_mail","" + dist_mail[index_do] + "");  
			set_cookie("url",""+ distributors[index_do] + "");  
			set_cookie("ref_path",""+ path[index_do] + "");  
			//alert("path "+ path[index_do]);  
			//alert("URL "+get_cookie("ref_url"));  
			//alert("Distributor Name"+get_cookie("ref_name"));  
			//alert("Path is "+get_cookie("ref_path"));  
			var i = get_cookie("ref_path");  
			//alert("i="+i);  
			loadXMLDoc(i);  
			changeurl();  
	}  
}  
function changeurl()  
{  
var changeurl= location.host;
var fullurl=document.location.href;
var fullurl1=fullurl.split('/');
var urlpart= fullurl1[3]; 

if(changeurl=='laurels.com')  
{
window.location.replace("http://www.laurels.com/" + urlpart)  
}  
}