ddsmoothmenu.init({
	mainmenuid: "smoothmenu1", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
});


     var pgo=0;
      function JumpUrl(){
        if(pgo==0){ location='javascript:history.go(-1);'; pgo=1; }
      }

$(document).ready(function(){ 
	
 $("#starttime").date_input(); 
 
 var myDate=new Date();
 month=myDate.getMonth()+1;
 if (month<10) {
  month = '0' + month;
 }
 $("#starttime").val(myDate.getYear() + '-' + month + "-" + myDate.getDate());

 $("#gotopaypal").submit();

 /*----    --------*/
 
 $("tr:nth-child(2n)").css("background-color","#ecf6fc");
 
 $("tr").mouseover(function(){
	 //$(this).css("background-color","#cccccc");
 });
 $("tr").mouseout(function(){
	// $("tr:nth-child(2n)").css("background-color","#fff");
 });
 
 $(".text").mouseover(function(){
	 $(this).css("background-color","#f6f3f3");
 });
 $(".text").mouseout(function(){
	 $(this).css("background-color","#ffffff");
 });
 
 
 /*---------- end  ------*/
 
  /*--------- 订单文本样式 ---------*/
  $(".order-list").find(":text,textarea").focus(function(){
	  $(this).css({border:"1px solid red"});
  });
  $(".order-list").find(":text,textarea").blur(function(){
	  $(this).css({border:"1px solid #c7dbf2"});
  });
  /*--------- end  --------*/

  $("#button-buyok").click(function(){
	   $.ajax({
		   type: "POST",
		   url: "buy.php?c=order&a=save",
		   data : getdata() ,
		   //data: "name=John&location=Boston",
		   success: function(msg){
	          window.location.href='template/loadmycar.html';
		   }
		}); 
	  
  });
  
   $("#button-buycar").click(function(){
	   
	   $.ajax({
		   type: "POST",
		   url: "buy.php?c=order&a=save",
		   data : getdata() ,
		   success: function(msg){
		     $("#carmsg").show();
		   }
		}); 
	   
   });
   
   $(".button-delcar").click(function(){
		   id=$(this).attr("id");
		   //alert(id);
		    $.ajax({
			   type: "POST",
			   url: "../../index.php/Buy/Del/",
			   data : "id=" + id ,
			   //data: "name=John&location=Boston",
			   success: function(msg){
			      window.location.reload();
			   }
			}); 
	   });
   
   
   
    /*
     * 分配订单-勾选分配
     */
   $(".checkbox-oid").click(function(){
	    var getid='0,';
	  if ($(this).attr("checked")==true)
	  {
		  $("input[class*=" + this["className"] + "]").each(function(){
			  if ($(this).attr("checked")==true)
			  {
				getid += $(this).attr("id") + ",";
			  }
		  });
	  }
	  getid += 0;
	   $(".hidden-oid").val(getid); 
   });
   
   
    /*
     * 分配订单---勾选用户
     */
   $("#button-distributionorder").click(function(){
	   $("input[class*='distributionuid']").each(function(){
		   if($(this).attr("checked")==true)
		   {
		   
			 $.ajax({
				 type : "POST",
				 url  : "distribution.php?t=orderdistributionsave" ,
			     dataType : "html" ,
			     data :  "selectoid=" + $("#selectoid").text() + "&selectuid="  + $(this).attr("id"),
			     success : function(msg){
				      $("#msg").text(msg);
			    }
			});
		   }
	   }); 
   });
   
   /*
    * 用户管理--勾选
    */
    $('.checkbox-uid').click(function(){
	      getid='0,';

			  $("input[class*=" + this["className"] + "]").each(function(){
				  if ($(this).attr("checked")==true)
				  {
					getid += $(this).attr("id") + ",";
					 
				  }
			  });
		  getid += 0;
		  $(".hidden-uid").val(getid); 
    });
    
    $("#button-generalmanager").click(function(){
    	$("input[class*='generaluid']").each(function(){
    		if ($(this).attr("checked")==true)
    		{
    	 
   			 $.ajax({
				 type : "POST",
				 url  : "usermanagement.php?t=usermanagesave" ,
			     dataType : "html" ,
			     data :  "selectuid=" + $("#selectuid").text() + "&selectotheruid="  + $(this).attr("id") + "&selectlevelid=" + $(".selectlevelid").attr("id"),
			     success : function(msg){
				      $("#msg").text(msg);
			    }
    		  });
    		}
    	});
    });
    /*
	$("#button-register").click(function(){
		if($("input[name='tcode']").val()=='')
		{
			alert("验证码不能为空!");
		    return false;
		}
		if($("input[name='tusername']").val()=='')
		{
			alert("用户名不能为空!");
		    return false;
		}
		if($("input[name='password']").val()=='')
		{
			alert("密码不能为空!");
		    return false;
		}
		if($("input[name='tconfirmpassword']").val()=='')
		{
			alert("再次密码不能为空!");
		    return false;
		}
		if($("input[name='tfirstname']").val()=='')
		{
			alert("再次密码不能为空!");
		    return false;
		}
		return true;
	});
	*/
	
    $(".servermain").mouseover(function(){
        $(this).css({border:"1px dotted #fb4a4a"});
    });
    $(".servermain").mouseout(function(){
        $(this).css({border:"0px solid #ccc"});
     });

});

 /*
  * 获取客户填写订单值
  */
 function getdata()
 {
	 var otype=$("#ordertype").val();
	 switch (otype)
	 {
	 case 'bookmark' : data=("stime=" + $("#starttime").val()  + "&title=" + $("#ttitle").val() + "&title1=" + $("#ttitle1").val() + "&title2=" + $("#ttitle2").val() + "&title3=" + $("#ttitle3").val() + "&des=" + $("#tdescription").val() + "&keyword=" + $("#tkeywords").val() + "&url=" + $("#turl").val() + "&comments=" + $("#tcomments").val()); break;
	 case 'squidoo' :  data=("stime=" + $("#starttime").val()  + "&tanchor=" + $("#tanchor").val() + "&turl=" + $("#turl").val()  + "&tcontent=" + $("#tcontent").val()); break;
	 case 'directory' : data=("stime=" + $("#starttime").val() + "&name=" + $("#name").val() + "&title=" + $("#title").val() + "&dess=" + $("#descriptions").val() + "&desl=" + $("#descriptionl").val() + "&category=" + $("#category").val()  +  "&keyword=" + $("#keywords").val() + "&url=" + $("#url").val() + "&exclude=" + $("#exclude").val()); break;
	 case 'press' : data=("stime=" + $("#starttime").val() + "&title=" + $("#title").val() + "&summary=" + $("#summary").val() + "&aboutauthor=" + $("#aboutauthor").val() + "&tags=" + $("#tags").val() + "&category=" + $("#category").val()  +  "&author=" + $("#author").val() + "&business=" + $("#business").val() + "&address=" + $("#address").val() + "&phone=" + $("#phone").val() + "&comments=" + $("#comments").val()); break;
	 case 'blog' : data=("stime=" + $("#starttime").val() + "&url=" + $("#url").val() + "&des=" + $("#des").val() + "&name=" + $("#name").val() + "&mail=" + $("#mail").val() + "&title=" + $("#title").val()  +  "&blogname=" + $("#blogname").val()); break;
	 default : data= 'void';  break;
	 }
	 data = data + "&otype=" +otype + "&action=" + $("#action").val() + "&sid=" + $("#sid").val();
	 return data;
 }
 
 

 
