﻿ function setms(cans)
    {
    
    var can1,can2,can3,can4,url;
    switch(cans)
    {
    case 1:
    can1="留言标题和内容不能为空!";
    can2="留言标题不能为空!";
    can3="留言内容不能为空!";
    can4="提交成功!";
    url='../ms.aspx';
    break;
    case 2:
    can1="Message title and content can not be empty!";
    can2="Title can not be empty!";
    can3="Message content can not be empty!";
    can4="Success,thanks!";
    url='../ms.aspx';
    
    
    case 3:
    can1="Message title and content can not be empty!";
    can2="Title can not be empty!";
    can3="Message content can not be empty!";
    can4="Success,thanks!";
    url='../ms.aspx';
    
    case 4:
    can1="Message title and content can not be empty!";
    can2="Title can not be empty!";
    can3="Message content can not be empty!";
    can4="Success,thanks!";
    url='../ms.aspx';
    
    break;
    default:
    can1="留言标题和内容不能为空!";
    can2="留言标题不能为空!";
    can3="留言内容不能为空!";
    can4="提交成功!";
    url='ms.aspx';
    break;  
    }
//    if(cans==1)
//    {
//    can1="留言标题和内容不能为空!";
//    can2="留言标题不能为空!";
//    can3="留言内容不能为空!";
//    can4="提交成功!";
//    }
//    else 
//    {
//    can1="Message title and content can not be empty!";
//    can2="Title can not be empty!";
//    can3="Message content can not be empty!";
//    can4="Success,thanks!";
//    }
    
      if ($F('txtTitle') == "" && $F('txtContent')=="")
        {
            alert(can1);
        }
        else if($F('txtTitle')=="")
        {
        alert(can2);
        }
        else if($F('txtContent')=="")
        {
        alert(can3);
        }
        else
        {
        var inp=$('txtTitle','txtContent','company','addr','txtName','tel','mob');
        var pars='pars='+$F('txtTitle')+'-'+$F('txtContent')+'-'+$F('company')+'-'+$F('addr')+'-'+$F('txtName')+'-'+$F('tel')+'-'+cans;
        var myAjax=new Ajax.Request(
        url,{method:'POST',
        parameters: pars,
        onComplete: showms
        });
        function showms(ms)
            {
                alert(can4);
                //循环数组清空
                inp.each(function(va){
                va.value="";
                }
                );
            }
        }  
    }
    
    
    
//图片现实功能
function Searchresult(id,pic)
{
var url="Ajax_product.aspx?v="+id+"&time="+(new Date()).getTime();
var pars='v='+id+'&time='+(new Date()).getTime();
var myAjax=new Ajax.Request(
        url,{method:'POST',
        parameters: pars,
        onComplete: showms
        });
        function showms(ms)
        {
        $('cpjj').innerHTML=ms.responseText;
        $('proimg').innerHTML="<a href='upfile/"+pic+ "' rel='lightbox[asd]'><img style='width: 320px; border:0px;' src='upfile/s"+pic+ "' />";
        }
 }


 function HotalOrder(cans)
    {
    
    var can1,can2,can3,can4,url,sex,ParId;
    switch(cans)
    {
    case 1:
    can1="请填写带星号选项!";
    can4="提交成功!";
    url='ms.aspx';
    break;
    case 2:
    can1="Message title and content can not be empty!";
    can2="Title can not be empty!";
    can3="Message content can not be empty!";
    can4="Success,thanks!";
    url='../ms.aspx';
    
    
    case 3:
    can1="Message title and content can not be empty!";
    can2="Title can not be empty!";
    can3="Message content can not be empty!";
    can4="Success,thanks!";
    url='../ms.aspx';
    
    case 4:
    can1="Message title and content can not be empty!";
    can2="Title can not be empty!";
    can3="Message content can not be empty!";
    can4="Success,thanks!";
    url='../ms.aspx';
    
    break;
    default:
    can1="留言标题和内容不能为空!";
    can2="留言标题不能为空!";
    can3="留言内容不能为空!";
    can4="提交成功!";
    url='ms.aspx';
    break;  
    }
//    if(cans==1)
//    {
//    can1="留言标题和内容不能为空!";
//    can2="留言标题不能为空!";
//    can3="留言内容不能为空!";
//    can4="提交成功!";
//    }
//    else 
//    {
//    can1="Message title and content can not be empty!";
//    can2="Title can not be empty!";
//    can3="Message content can not be empty!";
//    can4="Success,thanks!";
//    }
if(document.getElementById('sexnan').checked)
{
sex=1;
}
else
{
sex=0;
}
    
      if ($F('RealName') == "" || $F('tel')=="" || $F('hotelnum')=="" || $F('fromdate1')=="" || $F('leavedate')=="" )
        {
            alert(can1);
        }
        else
        {
//        var inp=$('RealName','tel','company','fax','email','fromdate1','leavedate');
        var pars='orders='+$F('RealName')+','+$F('tel')+','+sex+','+$F('company')+','+$F('email')+','+$F('fromdate1')+','+$F('leavedate')+','+$F('ParId')+','+$F('hotelnum')+','+$F('moneyrmb')+','+$F('card')+','+document.getElementById('tecontent').value+','+$F('fax')+','+cans;
        var myAjax=new Ajax.Request(
        url,{method:'POST',
        parameters: pars,
        onComplete: showms
        });
        function showms(ms)
            {
                alert(can4);
                //循环数组清空
//                inp.each(function(va){
//                va.value="";
//                }
//                );
            }
        }  
    }