jQuery(document).ready(function() {


	jQuery("#various5").bind("click", function() {
	jQuery("#login_form").append('<input name="whr" class="whr" value="FSR" type="hidden" />');
	jQuery(".whr").val('FSR');
	});
	jQuery("#various2").bind("click", function() {
	jQuery("#login_form").append('<input name="whr" class="whr" value="IHE" type="hidden" />');
	jQuery(".whr").val('IHE');
	});
	jQuery("#megaanchor4").bind("click", function() {
	jQuery("#login_form").append('<input name="whr" class="whr" value="FSR" type="hidden" />');
	jQuery(".whr").val('FSR');
	});
	jQuery(".nolink1").bind("click", function() {
	jQuery("#login_form").append('<input name="whr" class="whr" value="FSR" type="hidden" />');
	jQuery(".whr").val('FSR');
	});
	jQuery("#various3").bind("click", function() {
	jQuery("#login_form").append('<input name="whr" class="whr" value="FSR" type="hidden" />');
	jQuery(".whr").val('FSR');
	});
	jQuery("#various6").bind("click", function() {
	jQuery("#login_form").append('<input name="whr" class="whr" value="FSR" type="hidden" />');
	jQuery(".whr").val('FSR');
	});
	jQuery("#various4").bind("click", function() {
	jQuery("#login_form").append('<input name="whr" class="whr" value="IHE" type="hidden" />');
	jQuery(".whr").val('IHE');
	});
	jQuery("#various7").bind("click", function() {
	jQuery("#login_form").append('<input name="whr" class="whr" value="IHE" type="hidden" />');
	jQuery(".whr").val('IHE');
	});
			jQuery("#various1").fancybox({
				'titlePosition'		: 'inside' 
			});
			
			jQuery("#various2").fancybox({
				'scrolling'		: 'no',
				'titleShow'		: false,
				'onClosed'		: function() {
				    jQuery("#login_error").hide();
				}
			});
			
			jQuery("#various3").fancybox({
				'titlePosition'		: 'inside' 
			});
			
			jQuery("#various4").fancybox({
				
				'titlePosition'		: 'inside' 
			});
			
			jQuery("#various5").fancybox({
				'titlePosition'		: 'inside' 
			});
			
			jQuery("#various6").fancybox({
				'titlePosition'		: 'inside' 
			});
			
			jQuery("#various7").fancybox({
				'titlePosition'		: 'inside' 
			});
			
			jQuery("#megaanchor1").fancybox({
				'scrolling'		: 'no',
				'titlePosition'		: 'inside' 
			});
				jQuery("#megaanchor4").fancybox({
				'scrolling'		: 'no',
				'titlePosition'		: 'inside' 
			});
			jQuery(".nolink1").fancybox({
				'scrolling'		: 'no',
				'titlePosition'		: 'inside' 
			});
			jQuery("#sRequest").fancybox({
				'scrolling'		: 'no',
				'titlePosition'		: 'inside' 
			});
			
			jQuery("#login_form").bind("submit", function() {
				
				//alert('ok');
				
				if (jQuery("#zip_code").val().length < 1 || jQuery("#zip_code").val().length > 5) {
				    jQuery("#login_error").html('Please enter a valid zip code.');
				    jQuery.fancybox.resize();
				    return false;
				}
			
				jQuery.fancybox.showActivity();
			
				jQuery.ajax({
					type		: "POST",
					url		: "/ajax/service.php",
					data		: jQuery(this).serializeArray(),
					dataType: 'json',
					success: function(theResponse) {
						if(theResponse.found){
							jQuery.fancybox.close();
							window.location = theResponse.data;
						}else{
						//jQuery.fancybox(theResponse);
						jQuery('#zipData').html(theResponse.data);
						jQuery.fancybox.resize();
						jQuery("#sRequest").trigger('click');
					}
					}
				});
			
				return false;
			});
			
			jQuery("#service_form").bind("submit", function() {
				
				//alert('ok');
				
				if (jQuery("#email").val().length < 1) {
				    jQuery("#service_error").html('Please enter a valid email address.');
				    jQuery.fancybox.resize();
				    return false;
				}
			
				jQuery.fancybox.showActivity();
			
				jQuery.ajax({
					type		: "GET",
					url		: "/ajax/newsletter_signup.php",
					data		: jQuery(this).serializeArray(),
					success: function(theResponse) {
						
						jQuery.fancybox.close();
					}
				});
			
				return false;
			});

		});
function signout()
					{
						if (window.XMLHttpRequest)
						{// code for IE7+, Firefox, Chrome, Opera, Safari
							xmlhttp=new XMLHttpRequest();
						}
						else
						{// code for IE6, IE5
							xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
						}
						xmlhttp.onreadystatechange=function()
						{
							if (xmlhttp.readyState==4 && xmlhttp.status==200)
							{
								xmlDoc=xmlhttp.responseXML;
					
					
								jQuery('.signinid').show();
								jQuery('.signoutid').hide();
								//document.getElementById('signiniddd').style.display='';
								//document.getElementById('signoutiddd').style.display='none';
								window.location="../index.php";
							}
						}
						xmlhttp.open("GET","/login.php?action=logout",true);
						xmlhttp.send();
					
					
					}

function changeaction(){
						if($('#searchpage').attr("selectedIndex")==0){
							$('#searchform').attr('action', '/shop/search.php');
							$('#query').attr('name','search_query');
						}else{
							$('#searchform').attr('action', 'http://<?php echo $MainSiteUrl?>/search/search.php');
							$('#query').attr('name','query');
						}
						
					}
					
					
