﻿// JScript 文件

 function CheckInfo()
{
    if(!IsChecked("ckb_region"))
    {
        alert("Please choose your favourite place for the next summit. Thanks!");
        return false;
    }
    if(!IsChecked("ckb_data"))
    {
        alert("Please let us know your convient time for the next summit. Thanks!");
        return false;
    }  
    if(!IsRadio("rad_joinnum"))
    {
        alert("please let us know how many times you participate in confereces every year. Thanks!");
        return false;
    }
    if(!IsRadio("rad_receivetype"))
    {
        alert("Please let us know how the means you get the information of this summit. Thanks");
        return false;
    }
    if(!IsRadio("rad_money"))
    {
        alert("Please select your yearly conference budget.  Thanks!");
        return false;
    }
    if(!IsRadio("rad_raly"))
    {
        alert("Please choose your favourite conference. Thanks!");
        return false;
    }
    if(!IsRadio("rad_isjoin"))
    {
        alert("Please let us know if you participated in the 1st IPS. Thanks!");
        return false;
    }        
    if(!IsRadio("rad_subject"))
    {
        alert("Please choose your favourite topics. Thanks!");
        return false;
    }
    if(!IsRadio("rad_attention"))
    {
        alert("please select fields you want the summit leans towards. Thanks!");
        return false;
    } 
    if(!IsChecked("ckb_prod"))
    {
        alert("Please let us know the upstream products you are concerned with. Thanks!");
        return false;
    }
    if(!IsChecked("ckb_comp"))
    {
        alert("Please choose the enterprise you wish to meet most in the summit. Thanks !");
        return false;
    }
    if(!IsChecked("ckb_factor"))
    {
        alert("please let us know your participation standard. Thanks!");
        return false;
    }   
    if(!IsRadio("rad_viewpoint"))
    {
        alert("Please comment on PU industry conferences. Thanks!");
        return false;
    }
    if($F("txt_name")=="")
    {
        alert("please enter your name!");
        $("txt_name").focus();
        return false;
    }
    if($F("txt_tel")=="")
    {
        alert("please enter your phone number!");
        $("txt_tel").focus();
        return false;
    }
    if($F("txt_address")=="")
    {
        alert("Please let us know the address of your company !");
        $("txt_address").focus();
         return false;
    }          
    if($F("txt_poster")!="")
    {
        if(isNaN($F("txt_poster")))
        {
            alert("he zip code you entered is not correct, please check and reenter!");
            return false;
        }
    }
    return true;
}

function ClearInfo()
{
    var objcho=$("diaocha").getElementsByTagName("input");
     for(var n=0;n<objcho.length;n++)
    {
        if(objcho[n].type=="checkbox" || objcho[n].type=="radio" && objcho[n].checked==true)
        {
            objcho[n].checked=false;
        }
    }
    $("txt_name").value=$("txt_comp").value=$("txt_tel").value="";
    $("txt_position").value=$("txt_address").value=$("txt_poster").value="";
}


function IsChecked(checkobj)
{    
    var flag=0;       
    var checks = $(checkobj).getElementsByTagName("input");
    for(var n=0;n<checks.length;n++)
    {
        if(checks[n].type=="checkbox" && checks[n].checked==true)
        {
            flag=1;
        }
    }
    if(flag==0)
    {           
        return false;
    }
    return true;
}

//判断单选框是否选中   
function IsRadio(radobj)
{
    var flag=0;       
    var checks = $(radobj).getElementsByTagName("input");
    for(var n=0;n<checks.length;n++)
    {
        if(checks[n].type=="radio" && checks[n].checked==true)
        {
            flag=1;
        }
    }
    if(flag==0)
    {           
        return false;
    }
    return true;
}    


function $(obj)
{
    return document.getElementById(obj);
}
function $F(obj)
{
    return $(obj).value;
}