function ddlServiceType_changeEvent() 
{     
	lastSelectedService = document.getElementById('ServiceTypeDDID').value;   

	if(document.getElementById('ServiceTypeDDID').value == 'InterstateMovers')
		document.getElementById('ctl00_ContentPlaceHolder1_ctl00_ddlToState').value = '0';     

	ShowHideObjects(); 
} 

function HideAllBlocks()
{
		document.getElementById('CarShippingDiv').style.display = 'none';             
		document.getElementById('FullServiceMovingDiv').style.display = 'none';              
		document.getElementById('InternationalMoversDiv').style.display = 'none';              		
}
function ShowBlock(id)
{
			document.getElementById(id).style.display = 'block';              		
}

function Validateform()
{
	//alert("2> dd val=" + document.getElementById('ServiceTypeDDID').value);
	switch(document.getElementById('ServiceTypeDDID').value)     
	{         

	case('FullServiceMoving'):             
		if (document.HomePageFastQuoteForm.FullServiceMovingZip.value=='')
		{
			alert("Please enter a valid zipcode");
			document.HomePageFastQuoteForm.FullServiceMovingZip.focus();
			return false;
		}

		if (document.HomePageFastQuoteForm.StateMovingToLocalLD.value=='-1')
		{
			alert("Please select state you are moving to.");
			document.HomePageFastQuoteForm.StateMovingToLocalLD.focus();
			return false;
		}

/*
		if (document.HomePageFastQuoteForm.MoveSizeLocalLD.value=='-1')
		{
			alert("Please select move size.");
			document.HomePageFastQuoteForm.MoveSizeLocalLD.focus();
			return false;
		}
*/
		Delete_Cookie('FullServiceMovingZip', '/', '');
		Set_Cookie( 'FullServiceMovingZip', document.HomePageFastQuoteForm.FullServiceMovingZip.value, '', '/', 'homebulletin.net', '' );

		Delete_Cookie('StateMovingToLocalLD', '/', '');
		Set_Cookie( 'StateMovingToLocalLD', document.HomePageFastQuoteForm.StateMovingToLocalLD.value, '', '/', 'homebulletin.net', '' );

		Delete_Cookie('MoveSizeLocalLD', '/', '');
		Set_Cookie( 'MoveSizeLocalLD', document.HomePageFastQuoteForm.MoveSizeLocalLD.value, '', '/', 'homebulletin.net', '' );

		document.HomePageFastQuoteForm.action="FullServiceMoving.asp";


		break;         

	case('CarShipping'):     
		if (document.HomePageFastQuoteForm.CarShippingFromSt.value=='-1')
		{
			alert("Please select the state from where you are shipping the car.");
			document.HomePageFastQuoteForm.CarShippingFromSt.focus();
			return false;
		}

		if (document.HomePageFastQuoteForm.CarShippingToSt.value=='-1')
		{
			alert("Please select the state to where you are shipping the car.");
			document.HomePageFastQuoteForm.CarShippingToSt.focus();
			return false;
		}


		Delete_Cookie('CarShippingFromSt', '/', '');
		Set_Cookie( 'CarShippingFromSt', document.HomePageFastQuoteForm.CarShippingFromSt.value, '', '/', 'homebulletin.net', '' );

		Delete_Cookie('CarShippingToSt', '/', '');
		Set_Cookie( 'CarShippingToSt', document.HomePageFastQuoteForm.CarShippingToSt.value, '', '/', 'homebulletin.net', '' );

		document.HomePageFastQuoteForm.action="CarShipping.asp";

	break;         

	case('InternationalMovers'):        

		if (document.HomePageFastQuoteForm.IntnMovingFromSt.value=='-1')
		{
			alert("Please select the state from where you are moving.");
			document.HomePageFastQuoteForm.IntnMovingFromSt.focus();
			return false;
		}

		if (document.HomePageFastQuoteForm.ToCountryDDListName.value=='-1')
		{
			alert("Please select the country to where you are moving.");
			document.HomePageFastQuoteForm.ToCountryDDListName.focus();
			return false;
		}


		Delete_Cookie('IntnMovingFromSt', '/', '');
		Set_Cookie( 'IntnMovingFromSt', document.HomePageFastQuoteForm.IntnMovingFromSt.value, '', '/', 'homebulletin.net', '' );

		Delete_Cookie('ToCountryDDListName', '/', '');
		Set_Cookie( 'ToCountryDDListName', document.HomePageFastQuoteForm.ToCountryDDListName.value, '', '/', 'homebulletin.net', '' );

		Delete_Cookie('MoveSizeIntn', '/', '');
		Set_Cookie( 'MoveSizeIntn', document.HomePageFastQuoteForm.MoveSizeIntn.value, '', '/', 'homebulletin.net', '' );
		document.HomePageFastQuoteForm.action="InternationalMovers.asp";

		break;         

	case('SelfStorage'):                      
		break;         

	case('SelfServiceULoad'):                    
		break;         

	case('OfficeCommercialMove'):                  
		break;         


	} 
}

function ShowHideObjects() 
{     

	//alert("2> dd val=" + document.getElementById('ServiceTypeDDID').value);
	switch(document.getElementById('ServiceTypeDDID').value)     
	{         

	case('FullServiceMoving'):             
		HideAllBlocks();
		ShowBlock('FullServiceMovingDiv');
		//document.getElementById('FullServiceMovingDiv').style.display = 'block';              
		//document.getElementById('CarShippingDiv').style.display = 'none';  
		//alert("after FullServiceMoving");		
		break;         

	case('CarShipping'):                  
		HideAllBlocks();
		ShowBlock('CarShippingDiv');	
		//document.getElementById('CarShippingDiv').style.display = 'block';             
		//document.getElementById('FullServiceMovingDiv').style.display = 'none';              
		//alert("after CarShipping");		
	break;         

	case('InternationalMovers'):        
		location='http://www.homebulletin.net/International_moving_companies.asp';
		HideAllBlocks();
		ShowBlock('InternationalMoversDiv');		
		//document.getElementById('CarShippingDiv').style.display = 'none';             
		//document.getElementById('FullServiceMovingDiv').style.display = 'none';              
		//document.getElementById('InternationalMoversDiv').style.display = 'block';              		
		break;         

	case('SelfStorage'):                      
		location='http://www.homebulletin.net/Storage/storage_space.htm';
		break;         

	case('SelfServiceULoad'):                      
		location='http://www.homebulletin.net/self-service-moving.asp';
		break;         

	case('OfficeCommercialMove'):	
		location='http://www.homebulletin.net/movingquotes/Commercial_Office_Moving_Companies.asp';
		break;     
	} 

	return true;
} 


function ddlFromCountry_changeEvent() 
{     
	ShowHideObjects();     
} 

function ddlToCountry_changeEvent() 
{     
	ShowHideObjects(); 
} 

function Set_Cookie( name, value, expires, path, domain, secure ) 
	{
		// set time, it's in milliseconds
		var today = new Date();
		today.setTime( today.getTime() );

		/*
		if the expires variable is set, make the correct 
		expires time, the current script below will set 
		it for x number of days, to make it for hours, 
		delete * 24, for minutes, delete * 60 * 24
		*/
		if ( expires )
		{
		expires = expires * 1000 * 60 * 60 * 24;
		}
		var expires_date = new Date( today.getTime() + (expires) );

		document.cookie = name + "=" +escape( value ) +
		( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
		( ( path ) ? ";path=" + path : "" ) + 
		( ( domain ) ? ";domain=" + domain : "" ) +
		( ( secure ) ? ";secure" : "" );
	}

	// this fixes an issue with the old method, ambiguous values 
	// with this test document.cookie.indexOf( name + "=" );
	function Get_Cookie( check_name ) {
		// first we'll split this cookie up into name/value pairs
		// note: document.cookie only returns name=value, not the other components
		var a_all_cookies = document.cookie.split( ';' );
		var a_temp_cookie = '';
		var cookie_name = '';
		var cookie_value = '';
		var b_cookie_found = false; // set boolean t/f default f
		
		for ( i = 0; i < a_all_cookies.length; i++ )
		{
			// now we'll split apart each name=value pair
			a_temp_cookie = a_all_cookies[i].split( '=' );
			
			
			// and trim left/right whitespace while we're at it
			cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
		
			// if the extracted name matches passed check_name
			if ( cookie_name == check_name )
			{
				b_cookie_found = true;
				// we need to handle case where cookie has no value but exists (no = sign, that is):
				if ( a_temp_cookie.length > 1 )
				{
					cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
				}
				// note that in cases where cookie is initialized but no value, null is returned
				return cookie_value;
				break;
			}
			a_temp_cookie = null;
			cookie_name = '';
		}
		if ( !b_cookie_found )
		{
			return null;
		}
	}			

	// this deletes the cookie when called
	function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
	( ( path ) ? ";path=" + path : "") +
	( ( domain ) ? ";domain=" + domain : "" ) +
	";expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}



function SetCompanyId(id)
{
		document.formfields.carryfields.value=document.formfields.carryfields.value + ",id=" + id;
		document.formfields.coid.value=id;		
		//alert("value=:" + document.formfields.carryfields.value);
		document.formfields.action="MovingCompanyProfile.asp";
		document.formfields.submit();
		//this.form.submit();
		//Set_Cookie( 'SetCompanyId', id, '', '/', 'homebulletin.net', '' );
}

function LaunchForm(id)
{
		document.formfields.carryfields.value=document.formfields.carryfields.value + ",id=" + id;
		document.formfields.coid.value=id;		
		//alert("value=:" + document.formfields.carryfields.value);
		document.formfields.action="MovingCompanyProfile.asp";
		document.formfields.submit();
		//this.form.submit();
		//Set_Cookie( 'SetCompanyId', id, '', '/', 'homebulletin.net', '' );
}

function LaunchQuoteForm()
{
		//document.formfields.carryfields.value=document.formfields.carryfields.value + ",id=" + id;
		//document.formfields.coid.value=id;		
		//alert("value=:" + document.formfields.carryfields.value);
		//document.formfields.action="http://www.homebulletin.net/quotes/movequotes.aspx";
		document.formfields.action="http://www.homebulletin.net/moving_quotes/move_quote_s2a.asp?id=ba1001";
		document.formfields.submit();
		//this.form.submit();
		//Set_Cookie( 'SetCompanyId', id, '', '/', 'homebulletin.net', '' );
}

function LaunchCarQuoteForm()
{
		//document.formfields.carryfields.value=document.formfields.carryfields.value + ",id=" + id;
		//document.formfields.coid.value=id;		
		//alert("value=:" + document.formfields.carryfields.value);
		//document.formfields.action="http://www.homebulletin.net/quotes/car-move-quotes.aspx";
		document.formfields.action="http://www.homebulletin.net/quotes/car-shipping-quotes.aspx";
		document.formfields.submit();
		//this.form.submit();
		//Set_Cookie( 'SetCompanyId', id, '', '/', 'homebulletin.net', '' );
}

function LaunchIntnQuoteForm()
{
		document.formfields.action="http://www.homebulletin.net/quotes/international-move-quotes.aspx";
		document.formfields.submit();
}

function LaunchmyQuoteForm(id)
{
		document.formfields.carryfields.value=document.formfields.carryfields.value + ",id=" + id;
		document.formfields.coid.value=id;		
		document.formfields.coids.value=Get_Cookie("VendorListStr");

		//alert("VendorListStr cookie val=" + Get_Cookie("VendorListStr"));
		//document.formfields.action="http://gpseway.com/quotes/movequotes.aspx";
		//document.formfields.action="http://www.homebulletin.net/quotes/movequotes.aspx";
		document.formfields.action="http://www.homebulletin.net/moving_quotes/move_quote_s2a.asp?id=ba1001";
		document.formfields.submit();
		//this.form.submit();
		//Set_Cookie( 'SetCompanyId', id, '', '/', 'gpseway.com', '' );
}


