﻿
var ERROR_DISPLAY = 'ALERT';
//var REDIRECT_URL = 'http://www.topmovingcompanies.com/results.aspx';
//var PARTNER = '';
//var SUB_PARTNER = '';
var INITIAL_SERVICE = '1001';
var INITIAL_STORAGE = '0';
var Type = '';
var Service = '';
var FromCity = '';
var FromState = '';
var FromPostal = '';
var FromCountry = '';
var FromCountryName = '';
var ToState = '';
var ToCountry = '';
var ToCountryName = '';
var Size = '';

function Init()
{
	document.getElementById('ddlMovingType').value = INITIAL_SERVICE;
	MovingTypeChange(document.getElementById('ddlMovingType'));
	if (INITIAL_SERVICE == 'Storage')
	{
		//document.getElementById('ddlStorageType').value = INITIAL_STORAGE;
	}
	InitilizeDdlState('ddlMovingToState'); 
	InitilizeDdlState('ddlAutoToState');
	InitilizeDdlCountry('ddlMovingFromCountry');
	InitilizeDdlCountry('ddlMovingToCountry');
}
function MovingTypeChange(ddl) 
{
	switch (ddl.value) {
		case ('1001'):
		case ('1013'):
			document.getElementById('trMovingZipCode').style.display = 'block';
			document.getElementById('trMovingToState').style.display = 'block';
			document.getElementById('trMovingFromCountry').style.display = 'none';
			document.getElementById('trMovingToCountry').style.display = 'none';
			document.getElementById('trMovingSize').style.display = 'block';
			document.getElementById('trAutoZipCode').style.display = 'none';
			document.getElementById('trAutoToState').style.display = 'none';
			//document.getElementById('trStorageType').style.display = 'none';
			document.getElementById('trStorageZipCode').style.display = 'none';
			break;
		case ('1002'):
			document.getElementById('trMovingZipCode').style.display = 'none';
			document.getElementById('trMovingToState').style.display = 'none';
			document.getElementById('trMovingFromCountry').style.display = 'none';
			document.getElementById('trMovingToCountry').style.display = 'none';
			document.getElementById('trMovingSize').style.display = 'none';
			document.getElementById('trAutoZipCode').style.display = 'block';
			document.getElementById('trAutoToState').style.display = 'block';
			//document.getElementById('trStorageType').style.display = 'none';
			document.getElementById('trStorageZipCode').style.display = 'none';
			break;
		case ('1000'):
			document.getElementById('trMovingZipCode').style.display = 'none';
			document.getElementById('trMovingToState').style.display = 'none';
			document.getElementById('trMovingFromCountry').style.display = 'block';
			document.getElementById('trMovingToCountry').style.display = 'block';
			document.getElementById('trMovingSize').style.display = 'block';
			document.getElementById('trAutoZipCode').style.display = 'none';
			document.getElementById('trAutoToState').style.display = 'none';
			//document.getElementById('trStorageType').style.display = 'none';
			document.getElementById('trStorageZipCode').style.display = 'none';
			break;
		case ('Storage'):
			document.getElementById('trMovingZipCode').style.display = 'none';
			document.getElementById('trMovingToState').style.display = 'none';
			document.getElementById('trMovingFromCountry').style.display = 'none';
			document.getElementById('trMovingToCountry').style.display = 'none';
			document.getElementById('trMovingSize').style.display = 'none';
			document.getElementById('trAutoZipCode').style.display = 'none';
			document.getElementById('trAutoToState').style.display = 'none';
			//document.getElementById('trStorageType').style.display = 'block';
			document.getElementById('trStorageZipCode').style.display = 'block';
			break;
	}
	SetFormTitle();
}
function SetFormTitle()
{
	switch(document.getElementById('ddlMovingType').value)
	{
		case('1000'):
			document.getElementById('divUloadWarning').style.display = 'none';
			if (document.getElementById('spnTitle') != null) document.getElementById('spnTitle').innerHTML = "<H1>Get Free International Shipping Quotes From Professional International Shipping Companies</H1>";
			break;
		case('1002'):
			document.getElementById('divUloadWarning').style.display = 'none';
			if (document.getElementById('spnTitle') != null) document.getElementById('spnTitle').innerHTML = "<H1>Get Free Auto Transport Quotes From Professional Auto Transport Companies</H1>";
			break;
		case('1001'):
			document.getElementById('divUloadWarning').style.display = 'none';
			if (document.getElementById('spnTitle') != null) document.getElementById('spnTitle').innerHTML = "<H1>Get Free Moving Quotes From Professional Moving Companies</H1>";
			break;
		case('1013'):
			document.getElementById('divUloadWarning').style.display = 'block';
			if (document.getElementById('spnTitle') != null) document.getElementById('spnTitle').innerHTML = "<H1>Get Free Self Service Moving Quotes From Professional Self Service Moving Companies</H1>";
			break;
		case('Storage'):
			document.getElementById('divUloadWarning').style.display = 'none';
			if (document.getElementById('spnTitle') != null) document.getElementById('spnTitle').innerHTML = "<H1>Get Free Storage Quotes From Professional Storage Companies</H1>";
			break;
	}
}
function SubmitForm() 
{
	switch(document.getElementById('ddlMovingType').value)
	{
		case('1000'):
			Type = 'Moving';
			Service = '1000';
			FromCountry = document.getElementById('ddlMovingFromCountry').value;
			FromCountryName = document.getElementById('ddlMovingFromCountry')[document.getElementById('ddlMovingFromCountry').selectedIndex].innerHTML;
			ToCountry = document.getElementById('ddlMovingToCountry').value;
			ToCountryName = document.getElementById('ddlMovingToCountry')[document.getElementById('ddlMovingToCountry').selectedIndex].innerHTML
			Size = document.getElementById('ddlMovingSize').value;
			break;
		case('1002'):
			Type = 'Moving';
			Service = '1002';
			FromPostal = document.getElementById('txtAutoZipCode').value;
			FromCountry = '1';
			ToState = document.getElementById('ddlAutoToState').value;
			ToCountry = '1';			
			break;
		case('1001'):
			Type = 'Moving';
			if (stateFromAjaxCall - document.getElementById('ddlMovingToState').value == 0)
				Service = '1012';
			else
				Service = '1001';
			FromPostal = document.getElementById('txtMovingZipCode').value;
			FromCountry = '1';
			ToState = document.getElementById('ddlMovingToState').value;
			ToCountry = '1';
			Size = document.getElementById('ddlMovingSize').value;				
			break;		
		case('1013'):
			Type = 'Moving';
			Service = document.getElementById('ddlMovingType').value;
			FromPostal = document.getElementById('txtMovingZipCode').value;
			FromCountry = '1';
			ToState = document.getElementById('ddlMovingToState').value;
			ToCountry = '1';
			Size = document.getElementById('ddlMovingSize').value;				
			break;
		case('Storage'):
			Type = 'Storage';
			//Service = document.getElementById('ddlStorageType').value;
			FromPostal = document.getElementById('txtStorageZipCode').value;			
			break;
	}
	BuildQueryString();
}
function BuildQueryString()
{
	var queryString = '';
	if (Type == 'Moving') {
		queryString += "?Type=Moving";
		queryString += "&Service=" + Service;
		queryString += ((FromPostal != '')? "&FromPostal=" + FromPostal : '');
		queryString += ((FromCountry != '')? "&FromCountry=" + FromCountry : '');
		queryString += ((FromCountryName != '')? "&FromCountryName=" + FromCountryName : '');
		queryString += ((ToState != '')? "&ToState=" + ToState : '');
		queryString += ((ToCountry != '')? "&ToCountry=" + ToCountry : '');
		queryString += ((ToCountryName != '')? "&ToCountryName=" + ToCountryName : '');
		queryString += ((Size != '')? "&Size=" + Size : '');
	}
	else 
	{
		queryString += "?Type=Storage";
		if ( INITIAL_STORAGE && INITIAL_STORAGE > 0 )
		    queryString += "&Service=" + INITIAL_STORAGE;
		else
		    queryString += "&Service=1010";// + Service;

		queryString += "&FromPostal=" + FromPostal;
	}
	if (Validate())
	{
		window.location.href = "/results.aspx" + queryString;
	}
}
var stateIdArray = new Array(-1,4,3,6,5,7,8,9,11,10,12,13,14,15,17,18,19,16,20,21,22,25,24,23,26,27,29,28,30,33,37,34,35,36,38,31,32,39,40,41,42,43,44,45,46,47,48,49,52,51,50,53,55,54,56);
var stateNameArray = new Array("Select a state","Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","District of Columbia","Florida","Georgia","Guam","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New York","North Carolina","North Dakota","Ohio","Oklahoma","Oregon","Pennsylvania","Puerto Rico","Rhode Island","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virgin Islands","Virginia","Washington","West Virginia","Wisconsin","Wyoming");
function InitilizeDdlState(objId)
{
	document.getElementById(objId).options.length = 0;
	for(var i=0; i< stateIdArray.length; i++) 
	{
		var anOptionA = new Option(stateNameArray[i],stateIdArray[i]);
		document.getElementById(objId).options.add(anOptionA);
	}
}

var countryIdArray = new Array(0,1,67746,67747,67748,67749,67750,67751,67752,67753,67754,67755,67756,67757,67758,67759,67760,67761,67762,67763,67764,67765,67766,67767,67768,67769,67770,67771,67772,67773,67774,67775,67776,67777,67778,67779,67780,67781,67782,67783,2,67784,67785,67786,67787,67788,67789,67790,67791,67792,67793,67794,67795,67796,67797,67798,67799,67800,67801,67802,67803,67804,67805,67806,67807,67808,67809,67810,67811,67812,67813,67814,67815,67816,67817,67818,67819,67820,67821,67822,67823,67824,67825,67826,67827,67828,67829,67830,67831,67832,67833,67834,67835,67836,67837,67838,67839,67840,67841,67842,67843,67844,67845,67846,67847,67848,67849,67850,67851,67852,67853,67854,67855,67856,67857,67858,67859,67860,67861,67862,67863,67864,67865,67866,67867,67868,67869,67870,67871,67872,67873,67874,67875,67876,67877,67878,67879,67880,67881,67882,67883,67884,67885,67886,67887,67888,67889,67890,67891,67892,67893,67894,67895,67896,67897,67898,67899,67900,67901,67902,67903,67904,67905,67906,67907,67908,67909,67910,67911,67912,67913,67914,67915,67916,67917,67918,67919,67920,67921,67922,67923,67924,67925,67926,67927,67928,67929,67930,67931,67932,67933,67934,67935,67936,67937,67938,67939,67940,67941,67942,67943,67944,67945,67946,67947,67948,67949,67950,67951,67952,67953,67954,67955,67956,67957,67958,67959,67960,67961,67962,67963,67964,67965,67966,67967,67968,67969,67970,67971,1,67972,67973,67974,67975,67976,67977,67978,67979,67980,67981,67982,67983,67984,67985,67986);
var countryNameArray = new Array("Select a country","United States of America","Afghanistan","Albania","Algeria","American Samoa","Andorra","Angola","Anguilla","Antarctica","Antigua and Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia-Herzegovina","Botswana","Bouvet Island","Brazil","British Indian Ocean Territory","British Virgin Islands","Brunei Darussalam","Bulgaria","Burkina Faso","Burma","Burundi","Cameroon","Canada","Canton And Enderbury Is.","Cape Verde","Cayman Islands","Central African Rep.","Chad","Chile","China","Christmas Island","Cocos (keeling) Island","Colombia","Comoros","Congo","Cook Islands","Costa Rica","Cote D'ivoire","Croatia","Cuba","Cyprus","Czech Republic","Czechoslovakia","Democratic Kampuchea","Democratic Yemen","Denmark","Djibouti","Dominica","Dominican Republic","Dronning Maud Island","East Timor","Ecuador","Egypt","El Salvador","England","Equatorial Guinea","Estonia","Ethiopia","Faeroe Islands","Falkland Islands-Malvinas","Fiji","Finland","France","French Guiana","French Polynesia","French Southern Terr","Gabon","Gambia","Georgia","Germany","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadaloupe","Guam","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Heard and Mcdonald Is.","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy","Jamaica","Japan","Johnston Island","Jordan","Kazakhstan","Kenya","Kiribati","Kuwait","Kyrgyzstan","Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg","Macau","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Martinique","Mauritania","Mauritius","Mexico","Midway Islands","Moldova","Monaco","Mongolia","Montserrat","Morocco","Mozambique","Namibia","Nauru","Nepal","Netherlands","Netherlands Antilles","Neutral Zone","New Caledonia","New Zealand","Nicaragua","Niger","Nigeria","Niue","Norfolk Island","North Korea","Norway","Oman","Pacific Is. Trust Terr.","Pakistan","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Pitcairn Islands","Poland","Portugal","Puerto Rico","Qatar","Reunion","Romania","Russia","Rwanda","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Scotland","Senegal","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Korea","Spain","Sri Lanka","St. Helena","St. Kitts-Nevis-Anguilla","St. Lucia","St. Pierre Et Miquelon","St. Vincent and The Grenadines","Sudan","Suriname","Svalbard and Jan Mayen Is.","Swaziland","Sweden","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Togo","Tokelau","Tonga","Trinidad And Tobago","Tunisia","Turkey","Turkmenistan","Turks And Caicos Is.","Tuvalu","U.S. Pacific Islands","U.S. Virgin Islands","Uganda","Ukraine","United Arab Emirates","United Kingdom","United States of America","Uruguay","Uzbekistan","Vanuatu","Vatican City State","Venezuela","Vietnam","Wake Island","Wales","Wallis and Futuna Is.","Western Sahara","Yemen Arab Republic","Yugoslavia","Zaire","Zambia","Zimbabwe");
function InitilizeDdlCountry(objId)
{
	document.getElementById(objId).options.length = 0;
	for(var i=0; i< countryIdArray.length; i++) 
	{
		var anOptionA = new Option(countryNameArray[i],countryIdArray[i]);
		document.getElementById(objId).options.add(anOptionA);
	}
}

function Validate()
{
	var Errors = '';
	switch(document.getElementById('ddlMovingType').value)
	{
		case('1000'):
			if (document.getElementById('ddlMovingFromCountry').value == 0) 
			{
				document.getElementById('spnMovingFromCountry').className = 'invalidfields';
				Errors += 'From Country - Required\n\r';
			}
			else
				document.getElementById('spnMovingFromCountry').className = 'validfields';
			if (document.getElementById('ddlMovingToCountry').value == 0)
			{ 
				document.getElementById('spnMovingToCountry').className = 'invalidfields';
				Errors += 'To Country - Required\n\r';
			}
			else
				document.getElementById('spnMovingToCountry').className = 'validfields';
			if (document.getElementById('ddlMovingSize').value == '0000') 
			{
				document.getElementById('spnMovingSize').className = 'invalidfields';
				Errors += 'Moving Size - Required\n\r';
			}
			else
				document.getElementById('spnMovingSize').className = 'validfields';
			break;
		case('1001'):
		case('1013'):
			if (document.getElementById('txtMovingZipCode').value == '') 
			{
				document.getElementById('spnMovingZipCode').className = 'invalidfields';
				Errors += 'From ZipCode - Required\n\r';
			}
			else
			{
				if (!ValidateZipCode(document.getElementById('txtMovingZipCode').value)) 
				{
					document.getElementById('spnMovingZipCode').className = 'invalidfields';
					Errors += 'From ZipCode - Invalid\n\r';
				}
				else
					document.getElementById('spnMovingZipCode').className = 'validfields';
					
			}
			if (document.getElementById('ddlMovingToState').value == -1) 
			{
				document.getElementById('spnMovingToState').className = 'invalidfields';
				Errors += 'To State - Required\n\r';
			}
			else
				document.getElementById('spnMovingToState').className = 'validfields';
			if (document.getElementById('ddlMovingSize').value == '0000') 
			{
				document.getElementById('spnMovingSize').className = 'invalidfields';
				Errors += 'Moving Size - Required\n\r';		
			}
			else
				document.getElementById('spnMovingSize').className = 'validfields';
			if (document.getElementById('ddlMovingType').value == '1013')
			{
				if (document.getElementById('ddlMovingToState').value - stateFromAjaxCall == 0)
					Errors += 'U-Load They\'ll Drive is not available within same state\n\r';
			}
			break;
		case('1002'):
			if (document.getElementById('txtAutoZipCode').value == '') 
			{
				document.getElementById('spnAutoZipCode').className = 'invalidfields';
				Errors += 'From ZipCode - Required\n\r';
			}
			else
			{
				if (!ValidateZipCode(document.getElementById('txtAutoZipCode').value)) 
				{
					document.getElementById('spnAutoZipCode').className = 'invalidfields';
					Errors += 'From ZipCode - Invalid\n\r';
				}
				else
					document.getElementById('spnAutoZipCode').className = 'validfields';
			}
			if (document.getElementById('ddlAutoToState').value == -1) 
			{
				document.getElementById('spnAutoToState').className = 'invalidfields';
				Errors += 'To State - Required\n\r';
			}
			else
				document.getElementById('spnAutoToState').className = 'validfields';	
			if (document.getElementById('ddlAutoToState').value - stateFromAjaxCall == 0)
				Errors += 'Moving a Car is not available within same state\n\r';
			break;
		case('Storage'):
			/*if (document.getElementById('ddlStorageType').value == '0') 
			{
				document.getElementById('spnStorageType').className = 'invalidfields';
				Errors += 'Storage Type - Required\n\r';
			}
			else
				document.getElementById('spnStorageType').className = 'validfields';*/
			if (document.getElementById('txtStorageZipCode').value == '') 
			{
				document.getElementById('spnStorageZipCode').className = 'invalidfields';
				Errors += 'Storage ZipCode - required\n\r';
			}
			else
			{
				if (!ValidateZipCode(document.getElementById('txtStorageZipCode').value)) 
				{
					document.getElementById('spnStorageZipCode').className = 'invalidfields';
					Errors += 'Storage ZipCode - Invalid\n\r';
				}
				else
					document.getElementById('spnStorageZipCode').className = 'validfields';
			}		
			break;
	}
	if (Errors != '')
	{
		if (ERROR_DISPLAY == 'ALERT')
			alert(Errors);
		return false;
	}
	else
	{
		return true;
	}
}
function ValidateZipCode(zipcode)
{
	if (zipcode.match(/^\d\d\d\d\d$/))
		if (stateFromAjaxCall > 0)
			return true;
	else
		return false;
}
var stateFromAjaxCall = '100';
function ResultsFromAjaxCall(str)
{
	stateFromAjaxCall = str;
}
function disableKeyPress(e)
{
	if(!e) e = window.event;
	if(e.keyCode == 13)
		return false;
	else
		return true;
}
function ValidateStateZip(sender)
{
	switch(sender.id)
	{
		case('txtMovingZipCode'):
			if (document.getElementById('txtMovingZipCode').value.length == 5)
				GetStateByZip(document.getElementById('txtMovingZipCode').value);
			break;
		case('txtAutoZipCode'):
			if (document.getElementById('txtAutoZipCode').value.length == 5)
				GetStateByZip(document.getElementById('txtAutoZipCode').value);
			break; 
		case('txtStorageZipCode'):
			if (document.getElementById('txtStorageZipCode').value.length == 5)
				GetStateByZip(document.getElementById('txtStorageZipCode').value);
			break;
	}
}

function CreateForm()
{
var html = '';
html += "<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
html += "	<tr>";
html += "		<td>";
html += "			<table class='jsf_svcstbl_' cellpadding='0' cellspacing='0'>";
html += "				<tr>";
html += "					<td>";
html += "						<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
html += "							<tr>";
html += "								<td class='jsf_service_field'>Service Needed:</td>";
html += "								<td class='jsf_field_value'><select id='ddlMovingType' class='jsf_ddlStyle' onchange='MovingTypeChange(this)' onkeyup='MovingTypeChange(this)'>";
html += "										<option value='1001'>Full Service Movers</option>";
html += "										<option value='1002'>Moving a Car</option>";
html += "										<option value='1000'>International</option>";
html += "										<option value='1013'>U-Load They'll Drive</option>";
html += "										<option value='Storage'>Storage</option>";
html += "									</select>";
html += "								</td>";
html += "							</tr>";
html += "						</table>";
html += "					</td>";
html += "				</tr>";
html += "				<tr>";
html += "					<td>";
html += "						<div id='trAutoZipCode' style='display:none'>";
html += "							<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
html += "								<tr>";
html += "									<td class='jsf_name_field'><span id='spnAutoZipCode'>Shipping Zip Code<b>*</b></span></td>";
html += "									<td class='jsf_field_value'><input type='text' maxlength='5' class='jsf_txtStyle' id='txtAutoZipCode' onkeypress='return disableKeyPress(event)' onkeyup='ValidateStateZip(this)' />&nbsp;&nbsp;&nbsp;<span id='spnAutoZipFinder' onclick='ShowZipFinder(this)'>Zip Code Finder</span></td>";
html += "								</tr>";
html += "							</table>";
html += "						</div>";
html += "						<div id='trAutoToState' style='display:none'>"; 
html += "							<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
html += "								<tr>";
html += "									<td class='jsf_name_field'><span id='spnAutoToState'>State Shipping To<b>*</b></span></td>";
html += "									<td class='jsf_field_value'><select id='ddlAutoToState' class='jsf_ddlStyle'></select></td>";
html += "								</tr>";
html += "							</table>";
html += "						</div>";
/*html += "						<div id='trStorageType' style='display:none'>";
html += "							<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
html += "								<tr>";
html += "									<td class='jsf_name_field'><span id='spnStorageType'>Storage Type<b>*</b></span></td>";
html += "									<td class='jsf_field_value'><select id='ddlStorageType' class='jsf_ddlStyle'>";
html += "											<option value='0'>Select Type</option>";
html += "											<option value='1010'>Self Storage</option>";
html += "											<option value='1022'>Mobile Storage</option>";
html += "										</select>";
html += "									</td>";
html += "								</tr>";
html += "							</table>";
html += "						</div>";*/
html += "						<div id='trStorageZipCode' style='display:none'>";
html += "							<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
html += "								<tr>";
html += "									<td class='jsf_name_field'><span id='spnStorageZipCode'>Storage Zip Code<b>*</b></span></td>";
html += "									<td class='jsf_field_value'><input type='text' maxlength='5' class='jsf_txtStyle' id='txtStorageZipCode' onkeypress='return disableKeyPress(event)' onkeyup='ValidateStateZip(this)' />&nbsp;&nbsp;&nbsp;<span id='spnStorageZipFinder' onclick='ShowZipFinder(this)'>Zip Code Finder</span></td>";
html += "								</tr>";
html += "							</table>";
html += "						</div>";
html += "						<div id='trMovingZipCode' style='display:block'>";
html += "							<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
html += "								<tr>";
html += "									<td class='jsf_name_field'><span id='spnMovingZipCode'>Moving From Zip Code<b>*</b></span></td>";
html += "									<td class='jsf_field_value'><input type='text' maxlength='5' class='jsf_txtStyle' id='txtMovingZipCode' onkeypress='return disableKeyPress(event)' onkeyup='ValidateStateZip(this)' />&nbsp;&nbsp;&nbsp;<span id='spnMovingZipFinder' onclick='ShowZipFinder(this)'>Zip Code Finder</span></td>";
html += "								</tr>";
html += "							</table>";
html += "						</div>";
html += "						<div id='trMovingToState' style='display:block'>";
html += "							<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
html += "								<tr>";
html += "									<td class='jsf_name_field'><span id='spnMovingToState'>I am Moving To<b>*</b></span></td>";
html += "									<td class='jsf_field_value'><select id='ddlMovingToState' class='jsf_ddlStyle' ></select></td>";
html += "								</tr>";
html += "							</table>";
html += "						</div>";
html += "						<div id='trMovingFromCountry' style='display:none;height:34px'>";
html += "							<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
html += "								<tr>";
html += "									<td class='jsf_name_field'><span id='spnMovingFromCountry'>Moving From Country<b>*</b></span></td>";
html += "									<td class='jsf_field_value'><select id='ddlMovingFromCountry' class='jsf_ddlStyle'></select></td>";
html += "								</tr>";
html += "							</table>";
html += "						</div>";
html += "						<div id='trMovingToCountry' style='display:none'>";
html += "							<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
html += "								<tr>";
html += "									<td class='jsf_name_field'><span id='spnMovingToCountry'>Moving To Country<b>*</b></span></td>";
html += "									<td class='jsf_field_value'><select id='ddlMovingToCountry' class='jsf_ddlStyle'></select></td>";
html += "								</tr>";
html += "							</table>";
html += "						</div>";
html += "						<div id='trMovingSize' style='display:block'>";
html += "							<table width='100%' cellpadding='0' cellspacing='0' border='0'>";
html += "								<tr>";
html += "									<td class='jsf_name_field'><span id='spnMovingSize'>Size Of Move<b>*</b></span></td>";
html += "									<td class='jsf_field_value'><select id='ddlMovingSize' class='jsf_ddlStyle'>";
html += "											<option value='0000'>Select Weight</option>";
html += "											<option value='0602'>Studio 1500 lbs</option>";
html += "											<option value='0604'>1 BR Small 3000 lbs</option>";
html += "											<option value='0605'>1 BR Large 4000 lbs</option>";
html += "											<option value='0606'>2 BR Small 4500 lbs</option>";
html += "											<option value='0607'>2 BR Large 6500 lbs</option>";
html += "											<option value='0608'>3 BR Small 8000 lbs</option>";
html += "											<option value='0609'>3 BR Large 9000 lbs</option>";
html += "											<option value='0610'>4 BR Small 10000 lbs</option>";
html += "											<option value='0612'>4 BR Large 12000 lbs</option>";
html += "											<option value='0611'>Over 12000 lbs</option>";
html += "										</select>";
html += "									</td>";
html += "								</tr>";
html += "							</table>";
html += "						</div>";
html += "					</td>";
html += "				</tr>";
html += "			</table>";
html += "		</td>";
html += "	</tr>";
html += "	<tr>";
html += "		<td class='jsf_tdSubmitButton'>";
html += "			<input type='button' value='Next >>>' onclick='SubmitForm()'/>";
html += "		</td>";
html += "	</tr>";
html += "</table>";

	
//	if (IsExtLinkValid())
//	{
		//document.getElementById('spnVisibleTitle').style.display = 'none';
		document.write(html);

		setTimeout("Init();", 1500);
		//Init();
		//ServiceType_change('Moving');
		//MovingTypeChange(document.getElementById('ddlMovingType'));
//	}
}
//var ERROR_DISPLAY = 'MESSAGE';
//var REDIRECT_URL = 'http://www.relocation.com/results.aspx';
var hdnState = '';
var hdnCity = '';
function SetZipFromZipFinder(zipcode, City, State)
{
	switch(document.getElementById('ddlMovingType').value)
	{
		case('1002'):
			document.getElementById('txtAutoZipCode').value = zipcode;
			ValidateStateZip(document.getElementById('txtAutoZipCode'));
			break;
		case('1001'):
		case('1013'):
			document.getElementById('txtMovingZipCode').value = zipcode;
			ValidateStateZip(document.getElementById('txtMovingZipCode'));
			break;
		case('Storage'):
			document.getElementById('txtStorageZipCode').value = zipcode;
			ValidateStateZip(document.getElementById('txtStorageZipCode'));
			break;
	}
	//hdnState = state;
	hdnCity = City;
	HideDhtml();
}

document.write('<div id="DhtmlDiv" class="js_form_zipfinder" style="display:none;"><div class="jsf_close"><span onclick="HideDhtml()">Close</span></div><div class="jsf_iframe"><iframe src="http://www.topmovingcompanies.com/MiscPages/ZipCodeFinder.aspx?h=1" id="iFrameZipFinder" frameborder="0" scrolling="no" width="250" height="250"></iframe></div></div>');
function ShowZipFinder(obj)
{
	findPosition(obj,"DhtmlDiv");
	document.getElementById('DhtmlDiv').style.display = 'block';
}
function findPosition( oElement, dhtmlDiv ) 
{
    oDiv = document.getElementById(dhtmlDiv);
    if( typeof( oElement.offsetParent ) != 'undefined' ) 
    {
        for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) 
        {
            posX += oElement.offsetLeft;
            posY += oElement.offsetTop;
        }
        oDiv.style.top = posY;// - document.getElementById('divSmartLinking').scrollTop;
        if (dhtmlDiv == 'DhtmlDiv')
			oDiv.style.top = posY - 70 + 'px';// - document.getElementById('divTree').scrollTop;
        //alert(document.getElementById('divSmartLinking').scrollTop);
        oDiv.style.left = posX + 155 + 'px';
    } 
    else 
    {
        oDiv.style.top = oElement.y + 'px';
        oDiv.style.left = oElement.x + 'px';
    }
    oDiv.style.visibility = 'visible';
}

function HideDhtml()
{
    document.getElementById('DhtmlDiv').style.visibility = 'hidden';
}
var appPath = '/';

