/* for right big buttons*/


function readCookie(name)  
 {  
   
     var cookiename = name + "=";  
   
     var ca = document.cookie.split(';');  
   
     for(var i=0;i < ca.length;i++)  
     {  
   
         var c = ca[i];  
   
         while (c.charAt(0)==' ') c = c.substring(1,c.length);  
   
         if (c.indexOf(cookiename) == 0) return c.substring(cookiename.length,c.length);  
   
     }  
   
     return null;  
   
 }  


$(document).ready(function() {
  
  

   $("ul#topnav li .sub").shadowOn({
		imagepath:"http://www.hoyes.com/menushadow/",
        imageset: 8
     });
	
	$("ul#topnav li")
	.mouseover(function(){
			$(this).find(".sub").show();
		})
		.mouseout(function(){
			$(this).find(".sub").hide();
		})
	
   
 
   

    $("select[name='yourcity_homepage']").change(function () {
          var str = "";
          $("select[name='yourcity_homepage'] option:selected").each(function () {
               str += $(this).val();
			   
			   var days = 100; 
			   var date = new Date();  
               date.setTime(date.getTime ()+(days*24*60*60*1000));  
               var expires = "; expires="+date.toGMTString();
			   var last_city_choice=readCookie('city_choice');
			   if(last_city_choice==null  || last_city_choice!=str){
				   document.cookie = ' city_choice='+ str + expires + '; path=/';  
				   // alert(last_city_choice);
			   }

				  $.post("/get_office_info_home.php", {city_id : str}, function(data){
						   if (data.length>0){ 
							 $("#contactus-container").html(data); 
  							 $("#contactus-container").css("display","none");
							 $('#contactus-container').fadeIn(1000);
						   } 
			  }) 
	   });
		  
    })
   .change();
   
  
  
	   $("select[name='yourcity']").change(function () {
	          var str = "";
	          $("select[name='yourcity'] option:selected").each(function () {
	               str += $(this).val();
				    
				   var days = 100; 
				   var date = new Date();  
	               date.setTime(date.getTime ()+(days*24*60*60*1000));  
	               var expires = "; expires="+date.toGMTString();
				   var last_city_choice=readCookie('city_choice');
				   if(last_city_choice==null  || last_city_choice!=str){
					   document.cookie = ' city_choice='+ str + expires+ '; path=/';  
					   // alert(last_city_choice);
				   }

					  $.post("/get_office_info.php", {city_id : str}, function(data){
						   if (data.length>0){ 
								 $(".office_info").html(data); 
								 $(".office_info").css("display","none");
								 $('.office_info').fadeIn(1000);
								 //$(".office_info").append('<script type="text/javascript" src="http://www.hoyes.com/livehelp314/livehelp_js.php?eo=1&department=5&amp;serversession=1&amp;pingtimes=15"></script>');
							   } 

						  /*.get('/livehelp314/livehelp_js.php', {eo:'1',department:'5',serversession:'1',pingtimes:'15'}, function(dataLc){
								 $(".live_chat").text('live chat test....<script type="text/javascript">' + dataLc + '</script>');							  
						  });*/   

				  })
					
					
				  
		   });
			  
	    })
	   .change();

});


