// JavaScript Document
$(document).ready(
	function(){
		$("#ttt").click(function(){window.location.href="login.php";});
		$("#lgre").click(function(){document.loginFrm.submit();});
		$("#pcksre").click(function(){document.pckselectFrm.submit();});
		$("#pckwpr").click(function(){window.location.href="pckselect.php";});
		$("#pckwre").click(function(){document.pckweightFrm.submit();});
		$("#pckipr").click(function(){window.location.href="pckweight.php";});
		$("#pckire").click(function(){document.pckinfoFrm.submit();});
		$("#blnipr").click(function(){window.location.href="pckinfo.php";});
		$("#blnire").click(function(){document.blninfoFrm.submit();});
		$("#cnfrme").click(function(){window.location.href="pckinfo.php";});
		$("#cnfrme_err").click(function(){window.location.href="blninfo.php";});
		$("#cnfrmp").click(function(){document.cnfrmFrm.submit();});
		$("#prctre").click(function(){document.prctransFrm.submit();});
		$("#sap").click(
			function(e){
				e.preventDefault();
				$("#b_fname").val(sap[0]);
				$("#b_lname").val(sap[1]);
				$("#b_add1").val(sap[2]);
				$("#b_add2").val(sap[3]);
				$("#b_city").val(sap[4]);
				$("#b_prov").val(sap[5]);
				$("#b_postal").val(sap[6]);
			}
		);
		$("#cp").click(
			function(e){
				e.preventDefault();
				$.fn.colorbox({width:"60%",inline:true,href:"#complete_message",onClosed:function(){window.location.href="index.php"}});
			}
		);
		$(".cl").click(
			function(e){
				e.preventDefault();
				$.fn.colorbox({width:"50%",inline:true,href:"#contact"});
			}
		);
		$(".st1").click(
			function(e){
				e.preventDefault();
				$.fn.colorbox({width:"842px",inline:true,href:"#st1"});
			}
		);
		$(".st2").click(
			function(e){
				e.preventDefault();
				$.fn.colorbox({width:"842px",inline:true,href:"#st2"});
			}
		);
		$(".st3").click(
			function(e){
				e.preventDefault();
				$.fn.colorbox({width:"842px",inline:true,href:"#st3"});
			}
		);
		$(".st4").click(
			function(e){
				e.preventDefault();
				$.fn.colorbox({width:"842px",inline:true,href:"#st4"});
			}
		);
		$(".st5").click(
			function(e){
				e.preventDefault();
				$.fn.colorbox({width:"842px",inline:true,href:"#st5"});
			}
		);
		/*$("#lbl a").click(
			function(e){
				e.preventDefault();
				$.fn.colorbox({width:"100%",height:"100%",iframe:true})
			}
		);*/
		$("#shipitnow img").hover(
			function(){
				$(this).attr("src","images/shipitnow_rs.png")
			},
			function(){
				$(this).attr("src","images/shipitnow_ns.png")
			}
		);
		$("#p_pckTime").click(
			function(){
				if($("#p_date").val()){
				  $dateString=$("#p_date").val();
				  
				  $pickUpDate=new Date($dateString);
				  $today=new Date();
				  $diff=$pickUpDate-$today;
				  
				  $days=Math.round($diff/(1000*60*60*24));
				  if(!$days){
					  $("#p_pckTime option").each(
							function(){
								if($(this).val()<3){
									$(this).attr("disabled","disabled");
								}
							}
					  );
				  }
				  else{
					  $("#p_pckTime option").each(
							function(){
								$(this).removeAttr("disabled");
							}
					  );
				  }
				}
			}
		);
		$("#orderNumber").keypress(
			function(e){
				if(e.keyCode==13)
					return false;
			}
		);
		$("#email").keypress(
			function(e){
				if(e.keyCode==13)
					return false;
			}
		);
		
		if($("#player").length)flowplayer("player", "lib/flowplayer/flowplayer-3.1.2.swf");
	}
);
