﻿////==========================================================================
////  登陆 开始
////==========================================================================

function KeyDown()
{
    if(event.keyCode==13) {
        event.keyCode = 9;
        return; 
    }
}
function KeyDown1()
{
	if(event.keyCode==13) {
		indexlogin();
	}
	
}
function KeyDown2() {
	if(event.keyCode==13) 
	{
		$Id("btnlogin").onclick();
	}
}

function infoKeyDown()
{
	if(event.keyCode==13) 
	{
		InfoLogin();
	}
}


function GetNewCode()
{
    return config.WebURL +"Common/Handler.ashx?ac=xy001&"+ Math.random();
}


function geturl()
{
    var str_url=window.location.href;
 	window.location.href=config.WebURL+"login."+ config.Suffix +"?surl="+str_url;    
	
}

//找回密码
function getPassword()
{
    if($Id("username").value==""){$Id("username").focus();return false;}
    if($Id("question").value==""){$Id("question").focus();return false;}
    if($Id("answer").value==""){$Id("answer").focus();return false;}
    if($Id("newpwd").value==""||$Id("newpwd").value.length< 6){$Id("newpwd").focus();return false;}
    if($Id("npassword").value==""||$Id("npassword").value.length< 6){$Id("npassword").focus();return false;}
    if($Id("newpwd").value!=$Id("npassword").value){$Id("newpwd").focus();return false;}
}

//加载身份和企业类别
function loadtype(Province_ID,Province_Name,C_ID,C_Name,UT_ID,UT_Type,sex)    
{
    addMouseEvent(1);
    $Id("companytype").value=UT_Type;
    $Id("companytypeid").value=UT_ID;
    $Id("ProvinceID").value=Province_ID;
    $Id("citytype").value=C_Name;
    $Id("citytypeid").value=C_ID;
    $Id("sext").value=sex;
    
    if(sex==1)
        $Id("sexy").checked=true;
    else
        $Id("sexn").checked=true;
}
function shousex(num)
{
    if(num==1)
    {
        $Id("sexy").checked=true;
        $Id("sexn").checked=false;
        $Id("sext").value=$Id("sexy").value;
    }
    else
    {
        $Id("sexn").checked=true;
        $Id("sexy").checked=false;
        $Id("sext").value=$Id("sexn").value;
    }
    basicinfo();
}

function btnlogin()
{
    window.location.href=config.WebURL+"login."+config.Suffix;
}
function btnreg()
{
    window.location.href=config.WebURL+"register."+config.Suffix;
}
////==========================================================================
////  登陆 结束
////==========================================================================

//判断输入页数
function getNO()
{
    if($Id("lbpage").value=="")
    {
    return alertmsg(false,'Please enter page number.');
    }
}

/****************************结束************************************************/
	
//搜索
function getfocus()
{
    $Id("keyword").value="";
}

//清空用户名和密码	
function ResetText()
{
$Id("txtUserName").value="";
$Id("txtUserPWD").value="";
$Id("txtCode").value="";
}	
////==========================================================================
////
////  搜索 开始
////
////==========================================================================

//20090723搜索修改
function xy_search() {

    var flagName = document.getElementById("xy_FlagName").value;
    if ($Id("xy_InfoType").value == "offerbuy") {
        $Id("seller").checked = false;
        $Id("buyer").checked = true;
        flagName = "offer";
        
    }
    else {
        $Id("seller").checked = true;
        $Id("buyer").checked = false;
    }
    searchClick(flagName);
}

function xy_ShowSearchMenu() {
	
    if (document.getElementById('headSel').style.display == 'none') {
        document.getElementById('headSel').style.display = 'block';
    } else {
        document.getElementById('headSel').style.display = 'none';
    }

    return false;
}


function xy_SelectSearchMenu(showName, flagName, infoType) {
    document.getElementById("xy_FlagName").value = flagName;

    document.getElementById("xy_InfoType").value = infoType;

    
    document.getElementById('headSlected').innerHTML = showName;
    document.getElementById('headSel').style.display = 'none';

    setTimeout("drop_hide('head')", 10);
}

function drop_mouseover(pos) {
    try { window.clearTimeout(timer); } catch (e) { }
}

function drop_mouseout(pos) {
    var posSel = document.getElementById(pos + "Sel").style.display;
    if (posSel == "block") {
        timer = setTimeout("drop_hide('" + pos + "')", 1000);
    }
}

function drop_hide(pos) {
    document.getElementById(pos + "Sel").style.display = "none";
}

/////////搜索修改结束
function xy_Sel_CurBigMenu(flagName)
{
    var pBox = document.getElementById('_xy_big_menu_box');

    var aEles = pBox.getElementsByTagName("a");

    for(var i=0;i<aEles.length;i++)
    {
        aEles[i].className ="";
    }
        
    if(flagName == undefined)
    {
        var curPage = location.href.replace(config.WebURL,"");
        
        curPage = curPage.substr(0,curPage.indexOf("/"));
        
        if(curPage == "")curPage ="index";
        
        var munuName = "_xymenu_" + curPage;
        
        try{
            document.getElementById(munuName).className ='tabactive';
        }catch(e){
            document.getElementById("_xymenu_index").className ='tabactive';
        }
   }
   else
   {
        if(flagName == "") flagName ="index";
        
        var munuName = "_xymenu_" + flagName;

        try{
            document.getElementById(munuName).className ='tabactive';
        }catch(e){
            document.getElementById("_xymenu_index").className ='tabactive';
        }
    }
}


//取得当前搜索的数据
function SearchGetValue()
{
    var arrquery = new Array("flag", "typeid", "keyword", "tradeid", "order", "areaid", "date", "showstyle", "pagesize", "pageindex");
    var url = location.href;

    //从地址中取得需要的数据
    url = url.substr(url.lastIndexOf("/")+1);
    
    var strSearchType
    var arrValue;

    if (config.BogusStatic) {
        var values = url.substring(0, url.lastIndexOf("." + config.Suffix));
        arrValue = values.split("-");
        if (values.indexOf("_") > 0)
            strSearchType = arrValue[0].split("_")[0];
        else {

            var str = location.href.substr(0, location.href.lastIndexOf("/"));

            strSearchType = str.substr(str.lastIndexOf("/") + 1).toLowerCase();

            if (strSearchType == "buying")
                strSearchType = "buyer";
            else if (strSearchType == "selling")
                strSearchType = "seller";
                
        }
        arrValue.shift();
        arrValue[2] = unescape(arrValue[2]);
    }
    else {
        strSearchType = url.substring(0, url.lastIndexOf("." + config.Suffix));
        strSearchType = strSearchType.split("_")[0];

        arrValue = new Array(arrquery.length);
        for (var i = 0; i < arrquery.length; i++) {
            arrValue[i] = GetQueryString(arrquery[i]);
        }
        arrValue[2] = unescape(arrValue[2]);
    }
    return {
        searchType:strSearchType,
        query:arrquery,
        value:arrValue,
        objData:{
            flag:arrValue[0],
            pt_id:arrValue[1],
            keyword:arrValue[2],
            areaid:arrValue[5],
            times:arrValue[6],
            showstyle:arrValue[7],
            pagesize:arrValue[8],
            pageindex:arrValue[9]
        }
    };    
}

function SearchSetDefaultValue() {
    var data = new SearchGetValue();    
    //var htmlobj = new Array("s","txtsearchkey","areatypeid","selectlistdid","txtkeyword");
    if(data.objData.keyword.indexOf(",") != -1) {
        var arr = data.objData.keyword.split(",");
        $Id("txtsearchkey").value = undefined == arr[0] ? "" : arr[0];
        $Id("txtkeyword").value = undefined == arr[1] ? "" : arr[1];
    }
    else {
        if ($Id("txtsearchkey")) {
            $Id("txtsearchkey").value = "undefined" == data.objData.keyword ? "" : data.objData.keyword;
        }
    }
    try
    {
    $Id("areatypeid").value = undefined == data.objData.areaid ? "" : data.objData.areaid;
    cla.Init();
    }catch(e){}
    
    if(undefined == data.objData.times) data.objData.times="";
    
    if("" != data.objData.times) {
        $Id("selectlistdid").value = data.objData.times;
        $Id("dname").innerHTML = "New messages within " + data.objData.times + " days";
    }
}

function SearchSetClassList(moduleName, typeID) {
    var data = new SearchGetValue();
    var query = "&moduleName=" + moduleName + "&typeID=" + typeID + "&areaid=" + data.objData.areaid;
    query += "&times=" + data.objData.times + "&keyword=" + data.objData.keyword + "&flag=" + data.searchType.substring(0,data.searchType.length-2);

    var ajaxcls = new Ajax("xy033",query);
    ajaxcls.onSuccess = function() {
        if (ajaxcls.state.result == "1") {
            if (ajaxcls.data) {
                var list = "";
                for (i = 0; i < ajaxcls.data.classlist.length; i++) {
                    list += "<a href=\"javascript:pturl(" + ajaxcls.data.classlist[i].classID + ");\">" + unescape(ajaxcls.data.classlist[i].className) + "<span>(" + ajaxcls.data.classlist[i].infoNum + ")</span></a>";
                }
                $Id("xy_ClassList").innerHTML = "" + list + "";
            }
            else {
                $Id("xy_ClassList").innerHTML = "No subclasses.";
            }
        }
        else
            $Id("xy_ClassList").innerHTML = "No subclasses.";
    }
}

function SearchKeyDown()
{
	if(event.keyCode==13) {
	    $Id("DoSearch").click();
	}
}

function CheckSearchKey(source) {
    if(source != "") {
        if(isNull(source)) {
            alertmsg(false, "input illegal searching conditions.");
            return false;
        }
        else if(!isTrueKeyWord(source)) {
        alertmsg(false, "input illegal searching conditions.");
            return false;
        }
        else if(!isNVarchar(source)) {
        alertmsg(false, "input illegal searching conditions.");
            return false;
        }
        else if(source.indexOf(",") > 0) {
        alertmsg(false, "\",\" is not allowed for the searching characters.");
            return false;
        }
    }
    return true;
}


//头部搜索
function searchClick(type)
{
    if(type=="news" || type=="exhibition")
    {
            SetNewsSearchURL();
       
        return;
    }
    
    if(type=="brand" || type=="company")
    {
        SetSearchURL(type,"seller");
        return;
    }
    
    if(type=="job")
    {
        SetJobSearchURL();
        return;
    }
    if(type=="search")
    {
         var data = new SearchGetValue();
                        
        if(data.searchType == "")
        {
            var strflag = location.href.split("/")[3];
            SetSearchURL(strflag,"seller");
        }
        else if (data.searchType == "sell" || data.searchType == "buy")
           SetSearchURL(data.objData.flag,data.searchType + "er");
        else if(data.searchType=="news")
            SetNewsSearchURL();
        else
            SetSearchURL(data.objData.flag,data.searchType);
        return;
    }
    
    SearchInfo(type);
}
function SearchInfo(strClassType)
{
    if($Id("seller").checked)
        SetSearchURL(strClassType,"seller");
    else
        SetSearchURL(strClassType,"buyer");
}

function SetSearchURL(strClassType,strs) {
    var key = $Fvalue("txtsearchkey"); //.replace(/\s/g,"");

    if(!CheckSearchKey(key)) return false;
    if (config.BogusStatic) {
        //var url = config.WebURL + "search/" + strs + "_search-"+strClassType+"--"+key+"-------."+config.Suffix;
        var url = "http://trade." + config.CookieDomain + "/";
        if (strClassType == "product")
            url += "products/list-product--" + key + "-------." + config.Suffix;
        else if (strClassType == "Company")
            url += "company/list-company--" + key + "-------." + config.Suffix;
        else if (strClassType == "offer" && strs == "seller")
            url += "selling/list-offer--" + key + "-------." + config.Suffix;
        else if (strClassType == "offer" && strs == "buyer")
            url += "buying/list-offer--" + key + "-------." + config.Suffix;
        else if (strClassType == "News")
            url = "http://news." + config.CookieDomain + "/buying/list-offer--" + key + "-------." + config.Suffix;
    }
    else {
        url = config.WebURL + "search/" + strs + "_search." + config.Suffix + "?flag=" + strClassType + "&keyword=" + key;
    }
	location = url;   
}

function SetNewsSearchURL() {
    var key = $Fvalue("txtsearchkey"); //.replace(/\s/g, "");
    if (!CheckSearchKey(key)) return false;
    var url = "";
    if(config.BogusStatic) {
        url = "http://news." + config.CookieDomain + "/search/news_search---" + key + "-----." + config.Suffix; 
    }
    else {
	    url = config.WebURL +"search/news_search."+config.Suffix+"?keyword="+key;
	}

	if (key == "Information searches") {
	    url = config.WebURL + "search/news_search--------." + config.Suffix;
	}
	
	location = url; 
}

function listSearchKeyDown() {
    var gk=event.keyCode;
	if(gk==13) 
	{
		listsearch();
	}
}

//列表筛选搜索
function listsearch() {


    if (!CheckSearchKey($Fvalue("txtkeyword"))) return false;
    var data = new SearchGetValue();
    // var href = config.WebURL + "search/" + data.searchType + "_search";

    var href = "/";

    if (data.searchType.toLowerCase() == "products")
        href += "products/list-product";
    else if (data.searchType.toLowerCase() == "company")
        href += "company/list-company";
    else if (data.searchType.toLowerCase() == "seller")
        href += "selling/list-offer";
    else if (data.searchType.toLowerCase() == "buyer")
        href += "buying/list-offer";
    else if (data.searchType.toLowerCase() == "exhibition")
        href += "exhibition/list-exhibition";
    if (config.BogusStatic) {
        data.query.shift();
        data.value.shift();
        for (var i = 0; i < data.query.length; i++) {            
            href += "-";
            if (data.query[i] == "areaid") {
                try {
                    href += $Fvalue("areatypeid");
                }
                catch (e) { }
            }
            else if (data.query[i] == "date")
                href += $Fvalue("selectlistdid");
            else if (data.query[i] == "keyword") {
            href += GetSearchKeyWord($Fvalue("txtkeyword"));
            } else if (data.query[i] == "order") {
                href += $Fvalue("orderby");
            } else if (data.query[i] == "pageindex") {
                var toPage = $Fvalue("cpage");
                if (toPage != "" && !isNaN(toPage) && toPage > 0) {
                    href += toPage;
                }
            }
            else
                href += (data.value[i] ? data.value[i] : "");
        }
        href += "." + config.Suffix;

    }
    else {
        href += "." + config.Suffix;
        for (var i = 0; i < data.query.length; i++) {
            href += (0 == i ? "?" : "&") + data.query[i] + "=";
            if (data.query[i] == "areaid") {
                try {
                    href += $Fvalue("areatypeid");
                }
                catch (e) { }
            }
            else if (data.query[i] == "date")
                href += $Fvalue("selectlistdid");
            else if (data.query[i] == "keyword") {
                href += GetSearchKeyWord(data.value[i]);
            } else if (data.query[i] == "order") {
                href += $Fvalue("orderby");
            } else if (data.query[i] == "pageindex") {
                var toPage = $Fvalue("cpage");
                if (toPage != "" && !isNaN(toPage) && toPage != "1") {
                    href += toPage;
                }
            }
            else
                href += data.value[i];
        }

    }
 
    window.location = href;
}


function GetSearchKeyWord(strkeyword) {
//    if(strkeyword.indexOf(",") != -1) {
//        var arr = strkeyword.split(",");
//        if ($Fvalue("txtkeyword") != "" && $Fvalue("txtkeyword") != "Keyword") {
//            return arr[0] + "," + $Fvalue("txtkeyword");
//        }
//        else {
//            return arr[0];
//        }
//    }
//    else {
        if ($Fvalue("txtkeyword") != "" && $Fvalue("txtkeyword") != "Keyword") {
            // return strkeyword + "," + $Fvalue("txtkeyword");
            return $Fvalue("txtkeyword");
        }
        else {
            return strkeyword;
        }
//    }
}


//-------------------Job Search Start---------------------------

function SetJobSearchURL()
{
    var key = $Fvalue("txtsearchkey");//.replace(/\s/g,"");
    
    if(!CheckSearchKey(key)) return false;    
    if(config.BogusStatic) {
        var url = config.WebURL + "job/list-----"+key+"---." + config.Suffix; 
    }
    else {
	    url = config.WebURL +"job/list."+config.Suffix+"?keyword="+key; 
	}
	location = url; 
}

//取得当前搜索的数据
function GetJobSearchValue()
{
    var arrquery = new Array("typeid","areaid","date","jobtype","keyword","pagesize","pageindex","custom");
    var url = location.href;

    //从地址中取得需要的数据
    url = url.substr(url.lastIndexOf("/")+1);
    
    var arrValue;
    
    if(config.BogusStatic)
    {
        var values = url.substring(0,url.lastIndexOf("." + config.Suffix));
        arrValue = values.split("-");
        arrValue.shift();
        arrValue[4] = unescape(arrValue[4]);
    }
    else
    {
        arrValue = new Array(arrquery.length);
        for(var i =0; i<arrquery.length; i++) {
            arrValue[i] = GetQueryString(arrquery[i]);
        }
        arrValue[4] = unescape(arrValue[4]);
    }
    
    for(var i =0; i<arrquery.length; i++) {
        if(arrValue[i]==undefined || arrValue[i]=="undefined")arrValue[i] ="";
    }
            
    return {
        query:arrquery,
        value:arrValue,
        objData:{
            typeid:arrValue[0],
            areaid:arrValue[1],
            date:arrValue[2],
            jobtype:arrValue[3],
            keyword:arrValue[4],
            pagesize:arrValue[5],
            pageindex:arrValue[6],
            custom:arrValue[7]
        }
    };    
}


function SetJobSearchDefaultValue()
{
    var data = new GetJobSearchValue();
    if(data.objData.keyword.indexOf(",") != -1) {
        var arr = data.objData.keyword.split(",");
        $Id("txtsearchkey").value = arr[0]==undefined?"":arr[0];
        $Id("txtkeyword").value = arr[1]==undefined?"":arr[1];
    }
    else {
        if( data.objData.keyword != "undefined")
            $Id("txtsearchkey").value = data.objData.keyword;
    }
    try
    {
    $Id("typeid").value = data.objData.typeid;
    claPost.Init();
    }catch(e){}
    
    try
    {
    $Id("areaid").value = data.objData.areaid;
    claArea.Init();
    }catch(e){}
    
    if("undefined" == data.objData.date && "" != data.objData.date) {
        $Id("date").value = data.objData.date;
    }

    if("" != data.objData.jobtype){
        SetRadioValue("jobtype",data.objData.jobtype);
    }
}

function JobListSearch()
{   
    if(!CheckSearchKey($Fvalue("txtkeyword"))) return false;
    var data = new GetJobSearchValue();
    
    var href = config.WebURL + "job/list";    
    if(config.BogusStatic)
    {
        for(var i =0; i<data.query.length; i++) {
            href += "-";
           
            if(data.query[i] == "typeid"){
                href+=$Fvalue("typeid");
            }
            else if(data.query[i] == "areaid"){
                href += $Fvalue("areaid");
            }
            else if(data.query[i] == "date")
                href += $Fvalue("date");
            else if(data.query[i] == "keyword") {
                href += GetSearchKeyWord(data.value[i]);
            }else if(data.query[i] =="jobtype"){
                href += GetRadioValue("jobtype");
            }
            else
                href += data.value[i];
        }
        href += "." + config.Suffix;
    }
    else
    {
        href += "." + config.Suffix;
        for(var i =0; i<data.query.length; i++) {
            href += (0 == i ? "?" : "&") + data.query[i] + "=";
            if(data.query[i] == "typeid"){
                href +=$Fvalue("typeid");
            }            
            if(data.query[i] == "areaid"){
                href += $Fvalue("areaid");
            }
            else if(data.query[i] == "date")
                href += $Fvalue("date");
            else if(data.query[i] == "keyword") {
                href += GetSearchKeyWord(data.value[i]);
            }else if(data.query[i] =="jobtype"){
                href += GetRadioValue("jobtype");
            }
            else
                href += data.value[i];
        }
        
    }
    window.location  = href;
}

//设置单选按钮选中值
function SetRadioValue(name,value){
    var eles = document.getElementsByName(name);
    
    for(var i=0;i<eles.length;i++){
        if(eles[i].value==value){
            eles[i].checked = true;
            break;
        }
    }
    
    try{
    if(i==eles.length)eles[0].checked  = true;}catch(e){}
}

//获取单选按钮选中值
function GetRadioValue(name){
    var eles = document.getElementsByName(name);
    
    for(var i=0;i<eles.length;i++){
        if(eles[i].checked == true){
            return eles[i].value;
        }
    }    
    
    return "";
}

//-------------------Job Search End--------------------------
/*
字符串验证
*/
//是否为空白字符
function isNull(obj)
{
    var reg =/^\s/;
    if(reg.test(obj))return true;
    return false; 
}
//是否为字母和数字
function isTrueKeyWord(obj)
{
    var reg1 =/[^\uFF00-\uFFFF]/;

    if(reg1.test(obj))return true;

    return false;
}
//是否为汉字
function isNVarchar(obj)
{
     //2010.08.31 begin
    //var reg =/\w|^[\u0391-\uFFE5]+$Id/;
    var reg = /\w|^[\u0391-\uFFE5]/;
    //2010.08.31 end
    if(reg.test(obj))return true;
    return false;
}

//列表搜索
function listsearchClick()
{
    if($Id("txtsearchkey").value != "")
        window.location.href = $Id("txtsearchkeyurl").value +"?keyword=" + $Id("txtsearchkey").value;
    else
        window.location.href = $Id("txtsearchkeyurl").value;
    
}

//页面加载
function onloadsearch(key)
{
    var type = $Id("txttype").value;
    GetSearchKey(type);
    $Id("txtsearchkey").value = key;
}

//搜索列表点击
function sethref(type)
{
    var url = "";
    
    url = "search/"+$Id("hidinfoflag").value+"_search";
    
    switch(type)
    {
        case "offer":
            if($Id("bogusstatic").value == "True")
            {
                url += escape("-offer"+ $Id("txtsearchwhere").value);
                url += "."+$Id("suffix").value;
            }
            else
            {
                url += "."+$Id("suffix").value + "?flag=offer" ;
                if($Id("txtsearchwhere").value.length > 0)
                {
                    url +=  $Id("txtsearchwhere").value;
                }
            }
            break;
        case "machining":
            if($Id("bogusstatic").value == "True")
            {
                url += escape("-machining"+ $Id("txtsearchwhere").value);
                url += "."+$Id("suffix").value;
            }
            else
            {
                url += "."+$Id("suffix").value+ "?flag=machining" ;
                if($Id("txtsearchwhere").value.length > 0)
                {
                    url += $Id("txtsearchwhere").value;
                }
            }
            break;
        case "investment":
            if($Id("bogusstatic").value == "True")
            {
                url += escape("-investment"+ $Id("txtsearchwhere").value);
                url += "."+$Id("suffix").value;
            }
            else
            {
                url += "."+$Id("suffix").value + "?flag=investment" ;
                if($Id("txtsearchwhere").value.length > 0)
                {
                    url +=$Id("txtsearchwhere").value;
                }
            }
            break;    
        case "service":
            if($Id("bogusstatic").value == "True")
            {
                url += escape("-service"+ $Id("txtsearchwhere").value);
                url += "."+$Id("suffix").value;
            }
            else
            {
                url += "."+$Id("suffix").value + "?flag=service" ;
                if($Id("txtsearchwhere").value.length > 0)
                {  
                    url += $Id("txtsearchwhere").value;
                }
            }
            break;
        case "exhibition":
            if($Id("bogusstatic").value == "True")
            {
                url += escape("-exhibition"+ $Id("txtsearchwhere").value);
                url += "."+$Id("suffix").value;
            }
            else
            {
                url += "."+$Id("suffix").value+ "?flag=exhibition" ;
                if($Id("txtsearchwhere").value.length > 0)
                {
                    url += $Id("txtsearchwhere").value;
                }
            }
            break;
        case "brand":
            if($Id("bogusstatic").value == "True")
            {
                url += escape("-brand"+ $Id("txtsearchwhere").value);
                url += "."+$Id("suffix").value;
            }
            else
            {
                url += "."+$Id("suffix").value+ "?flag=brand";
                if($Id("txtsearchwhere").value.length > 0)
                {
                    url += $Id("txtsearchwhere").value;
                }
            }
            break;
        case "company":
            if($Id("bogusstatic").value == "True")
            {
                url += escape("-company"+ $Id("txtsearchwhere").value);
                url += "."+$Id("suffix").value;
            }
            else
            {
                url += "."+$Id("suffix").value+ "?flag=company";
                if($Id("txtsearchwhere").value.length > 0)
                {
                    url += $Id("txtsearchwhere").value;
                }
            }
            break;
        case "news":
            if($Id("bogusstatic").value == "True")
            {
                url +=escape("-news"+ $Id("txtsearchwhere").value);
                url += "."+$Id("suffix").value;
            }
            else
            {
                url += "."+$Id("suffix").value+"?flag=news" ;
                if($Id("txtsearchwhere").value.length > 0)
                {
                    url += removeurlparameter("cid",removeurlparameter("provinceid",$Id("txtsearchwhere").value));
                    
                }
            }
            break;
    }
    window.location.href = config.WebURL +url;
}

//人才列表切换显示方式
function setjobshowstyle(flag)
{
    var showstyle = "";
    if(flag==1)
    {
        $Id("detail").className = "on";
        $Id("nodetail").className = "off";
        showstyle = "detail";
    }
    else
    {
        $Id("detail").className = "off";
        $Id("nodetail").className = "on";
        showstyle = "nodetail";
    }
    var href = window.location.href;
    var nameArray =  new Array();
    var valueArray = new Array();
           
    if($Id("bogusstatic").value == "True")
    {
        var starindex =href.substring(0,href.substring(0,href.lastIndexOf('-')).lastIndexOf('-') ).lastIndexOf('-');
        href = href.substring(0,starindex+1)+ showstyle + href.substring(href.substring(0,href.lastIndexOf('-')).lastIndexOf('-'),href.length);
    }
    else
    {
        if(href.indexOf('?',0)==-1)
        {
            href +="?showstyle="+showstyle;
        }
        else    
        {
            if(href.indexOf('showstyle',0)==-1)
            {
                href += "&showstyle="+showstyle;
            }
            else
            {
                nameArray[0] = "showstyle";
                valueArray[0] = showstyle;
                href = changeLocationParameter(nameArray,valueArray);
            }
        }
    }
     window.location.href = href;
}
//初始化人才列表样式
//temp
function initjobshowstyle(flag)
{
    if(flag == "" || flag=="detail")
    {
        $Id("detail").className = "on";
        $Id("nodetail").className = "off";
    }
    else
    {
        $Id("detail").className = "off";
        $Id("nodetail").className = "on";
    }
}
function joblistSearchKeyDown()
{
    var gk=event.keyCode;
	if(gk==13) 
	{
		listsearch();
	}
}

//网店头部搜索
function shoptopsearch()
{
    var key = $Fvalue("shopsearchkey").replace(/\s/g,"");
    
    if(!CheckSearchKey(key)) return false;    
    if(config.BogusStatic) {
        var url = config.WebURL + "search/seller_search-"+$Fvalue("hidshopsearchflag")+"--"+key+"-------."+config.Suffix; 
    }
    else {
	    url = config.WebURL +"search/seller_search."+config.Suffix+"?flag="+$Fvalue("hidshopsearchflag")+"&keyword="+key; 
	}
	location = url;
}

//网店头部信息标识
function shoptopflag(num)
{
    switch(num)
    {
        case 1:
            $Id("ssoffer").className = "on";
            $Id("ssmachining").className = "";
            $Id("ssinvestment").className = "";
            $Id("ssservice").className = "";
            $Id("ssexhibition").className = "";
            $Id("ssbrand").className = "";
            $Id("hidshopsearchflag").value = "offer";
            break;
        case 2:
            $Id("ssoffer").className = "";
            $Id("ssmachining").className = "on";
            $Id("ssinvestment").className = "";
            $Id("ssservice").className = "";
            $Id("ssexhibition").className = "";
            $Id("ssbrand").className = "";
            $Id("hidshopsearchflag").value = "machining";
            break;
        case 3:
            $Id("ssoffer").className = "";
            $Id("ssmachining").className = "";
            $Id("ssinvestment").className = "on";
            $Id("ssservice").className = "";
            $Id("ssexhibition").className = "";
            $Id("ssbrand").className = "";
            $Id("hidshopsearchflag").value = "investment";
            break;
        case 4:
            $Id("ssoffer").className = "";
            $Id("ssmachining").className = "";
            $Id("ssinvestment").className = "";
            $Id("ssservice").className = "on";
            $Id("ssexhibition").className = "";
            $Id("ssbrand").className = "";
            $Id("hidshopsearchflag").value = "service";
            break;
        case 5:
            $Id("ssoffer").className = "";
            $Id("ssmachining").className = "";
            $Id("ssinvestment").className = "";
            $Id("ssservice").className = "";
            $Id("ssexhibition").className = "on";
            $Id("ssbrand").className = "";
            $Id("hidshopsearchflag").value = "exhibition";
            break;
        case 6:
            $Id("ssoffer").className = "";
            $Id("ssmachining").className = "";
            $Id("ssinvestment").className = "";
            $Id("ssservice").className = "";
            $Id("ssexhibition").className = "";
            $Id("ssbrand").className = "on";
            $Id("hidshopsearchflag").value = "brand";
            break;
    }
}

//设置页面显示记录条数
function funpagesize(num)
{
    var href = document.location.href.toLowerCase();
    var nameArray =  new Array();
    var valueArray = new Array();

    if (config.BogusStatic) {
        var starindex = href.substring(0, href.lastIndexOf('-')).lastIndexOf('-');

        if (starindex < 0) {
            if (href.indexOf("/company/") > 0)
                href = "/company/list-company---------.html";
            else if (href.indexOf("/selling/") > 0)
                href = "/selling/list-offer---------.html";
            else if (href.indexOf("/buying/") > 0)
                href = "/buying/list-offer---------.html";
            else if (href.indexOf("/products/") > 0)
                href = "/products/list-product---------.html";
            starindex = href.substring(0, href.lastIndexOf('-')).lastIndexOf('-');
        }

        href = href.substring(0, starindex + 1) + num + "-" + href.substring(href.lastIndexOf('.'), href.length);


    }
    else {
        if (document.location.href.indexOf('?', 0) == -1) {
            if (document.location.href.indexOf('pageindex', 0) != -1) {
                nameArray[0] = "pageindex";
                valueArray[0] = "1";
                href = changeLocationParameter(nameArray, valueArray);
            }
            href += "?pagesize=" + num;
        }
        else {
            if (document.location.href.indexOf('pagesize', 0) == -1) {
                href += "&pagesize=" + num;
            }
            else {
                nameArray[0] = "pagesize";
                valueArray[0] = num;
                if (document.location.href.indexOf('pageindex', 0) != -1) {
                    nameArray[1] = "pageindex";
                    valueArray[1] = "1";
                }
                href = changeLocationParameter(nameArray, valueArray);
            }
        }
    }
   window.location.href = href;
}

//按产品类别搜索
function pturl(ptid)
{
    var href = document.location.href.toLowerCase();
    var nameArray =  new Array();
    var valueArray = new Array();

    if (config.BogusStatic) {
        var starindex = href.indexOf('-', 0) + 1 + href.substring(href.indexOf('-', 0) + 1, href.length).indexOf('-', 0) + 1;
        if (starindex > 0)
            href = href.substring(0, href.indexOf('-', 0) + 1) + href.substring(href.indexOf('-', 0) + 1, href.length).substring(0, href.substring(href.indexOf('-', 0) + 1, href.length).indexOf('-', 0) + 1) + ptid + href.substring(starindex + href.substring(starindex, href.length).indexOf('-'), href.lastIndexOf('-') + 1) + href.substring(href.lastIndexOf('.'), href.length);
        else if (href.indexOf('selling') > 0)
            href = href + "list-offer-" + ptid + "--------.html";
        else if (href.indexOf('buying') > 0)
            href = href + "list-offer-" + ptid + "--------.html";
        else if (href.indexOf('products') > 0)
            href = href + "list-product-" + ptid + "--------.html";
        else if (href.indexOf('company') > 0)
            href = href + "list-company-" + ptid + "--------.html";
        else if (href.indexOf('exhibition') > 0) 
            href = href + "list-exhibition-" + ptid + "--------.html";

    }
    else
    {
        if(document.location.href.indexOf('?',0)==-1)
        {
            href += "?pt_id="+ptid; 
        }
        else
        {
            if(document.location.href.indexOf('pt_id',0)==-1)
            {
                    if(href.indexOf('pagesize',0)!=-1)
                    {
                        href = href.substring(0,href.indexOf('&pagesize',0)) + "&pt_id="+ptid +href.substring(href.indexOf('&pagesize',0),href.length);
                    }
                    else if(href.indexOf('pageindex',0)!=-1)
                    {
    //                     href = href.substring(0,href.indexOf('&pageindex',0)) + "&pt_id="+pt_id +href.substring(href.indexOf('&pageindex',0),href.length);
                        href= removeurlparameter("pageindex",href);
                        href += "&pt_id="+ptid;
                    }
                    else
                    {
                        href += "&pt_id="+ptid;
                    }
            }
            else
            {
                nameArray[0]  = "pt_id"; 
                valueArray[0] = ptid;
                href = changeLocationParameter(nameArray,valueArray); 
            }
        }
    }

    window.location.href = href;
}

//替换url参数值
function changeLocationParameter(nameArray,valueArray)
{
 var parameter=document.location.search.toString();
 var pname;
 var pstart,pend;
 
 for(var i=0;i<nameArray.length;i++)
 {
  pname=nameArray[i];
  pstart=parameter.indexOf(pname+"=");
   while(pstart>0)
  {
   if(parameter.charAt(pstart-1)=='?' || parameter.charAt(pstart-1)=='&')
   {
    pstart=pstart+pname.length+1;
    pend=parameter.indexOf("&",pstart);
    if(pend>=0)
     parameter=parameter.substring(0,pstart)+valueArray[i]+parameter.substring(pend,parameter.length);
    else
     parameter=parameter.substring(0,pstart)+valueArray[i];
    break;
   }
   else
    pstart=parameter.indexOf(pname+"=",pstart+pname.length+1);
  }
  if(pstart<0)
   parameter+="&"+nameArray[i]+"="+valueArray[i];
 }
 return parameter;
}

//去掉url参数
function removeurlparameter(name,strurl)
{
    var href = ""; 
    var url = "";
    if(strurl == null)
    {
        url = document.location.search.toString();
        url = url.substr(1);
    }  
    else
    {
        url = strurl;
    }
    
    strs = url.split('&');
    for(var i=0;i<strs.length;i++)
    {
        if(strs[i].split('=')[0] != name)    
        {
            href += "&" + strs[i];   
        }
    }
    return href.substr(1);
}

//设置列表显示样式
function setshowstyle(style)
{
    var nameArray =  new Array();
    var valueArray = new Array();
    if(style!="img")
    {
        if(config.BogusStatic)
        {
            var starindex =window.location.href.substring(0,window.location.href.substring(0,window.location.href.lastIndexOf('-')).lastIndexOf('-') ).lastIndexOf('-');
            window.location.href = window.location.href.substring(0,starindex+1)+ style + window.location.href.substring(window.location.href.substring(0,window.location.href.lastIndexOf('-')).lastIndexOf('-'),window.location.href.length);
        }
        else
        {
            if(document.location.href.indexOf('?',0)==-1)
            {
               window.location.href  = window.location.href+"?showstyle=noimg";
            }
            else
            {
                if(document.location.href.indexOf('showstyle',0)!=-1)
                {
                    nameArray[0]  = "showstyle";            
                    valueArray[0] = "noimg";
                    window.location.href = changeLocationParameter(nameArray,valueArray);   
                }
                else
                {
                    var strurl = window.location.href;
                    if(strurl.indexOf('pagesize',0)!=-1)
                    {
                        strurl = strurl.substring(0,strurl.indexOf('&pagesize',0)) + "&showstyle=noimg" +strurl.substring(strurl.indexOf('&pagesize',0),strurl.length);
                    }
                    else if(strurl.indexOf('pageindex',0)!=-1)
                    {
                         strurl = strurl.substring(0,strurl.indexOf('&pageindex',0)) + "&showstyle=noimg" +strurl.substring(strurl.indexOf('&pageindex',0),strurl.length);
                    }
                    else
                    {
                        strurl = strurl + "&showstyle=noimg";
                    }          
                    window.location.href  = strurl;
                }   
            }
        }
    }
    else
    {
        if(config.BogusStatic)
        {
            var starindex =window.location.href.substring(0,window.location.href.substring(0,window.location.href.lastIndexOf('-')).lastIndexOf('-') ).lastIndexOf('-');
            window.location.href = window.location.href.substring(0,starindex+1) + window.location.href.substring(window.location.href.substring(0,window.location.href.lastIndexOf('-')).lastIndexOf('-'),window.location.href.length);
        }
        else
        {
            if(document.location.href.indexOf('showstyle',0)!=-1)
            {
                nameArray[0]  = "showstyle";            
                valueArray[0] = "img";
                window.location.href = changeLocationParameter(nameArray,valueArray);        
            }
        }
    }
}
//对比产品
function compareinfo()
{
    var href = config.WebURL + "search/compare";
    
//    if($Id("bogusstatic").value == "True")
//    {
//        href += "-"+$Id("hidmoduleflag").value +"-";
//    }
//    else
//    {
        href +="." +config.Suffix + "?flag="+$Id("hidmoduleflag").value;
//    }
    var chk= document.getElementsByTagName("input");
    var num = 0;
    var ids = "";
    for (var i=0;i<chk.length;i++)
	{
		if( chk[i].type=='checkbox')
		{
			if(chk[i].checked == true)
			{
			    ids += ","+chk[i].value;
			    num ++;
			}
		}
	}
    
    if(ids.length>0)
    {
        if(num >4)
        {
            alertmsg(false, '4 messages comparisons or less');  
        }
        else
        {
//            if($Id("bogusstatic").value == "True")
//            {
//                href += ids.substring(1)+"."+$Id("suffix").value;
//            }
//            else
//            {
                href += "&id="+ids.substring(1);
//            }
            window.location.href  = href;
        }
    }
    else
    {
        alertmsg(false, 'Please select the messages compared.');  
    }
}



////==========================================================================
////  搜索 结束
////==========================================================================

///==========================================================================
////  商业信息详细 结束
////==========================================================================
function selectBox(num) {
    switch (num) {
        case 1:
            $Id("tab1").className = "choiceout";
            $Id("tab2").className = "choiceon";
            $Id("contentBox1").style.display = "block";
            $Id("contentBox2").style.display = "none";
            break;
        case 2:
            $Id("tab1").className = "choiceon";
            $Id("tab2").className = "choiceout";
            $Id("contentBox1").style.display = "none";
            $Id("contentBox2").style.display = "block";
            break;

        case 3:
            $Id("tab3").className = "choiceon";
            $Id("tab4").className = "choiceout";
            $Id("contentBox3").style.display = "block";
            $Id("contentBox4").style.display = "none";
            break;
        case 4:
            $Id("tab3").className = "choiceout";
            $Id("tab4").className = "choiceon";
            $Id("contentBox3").style.display = "none";
            $Id("contentBox4").style.display = "block";
            break
        case 5:
            $Id("ykinfo").className = "on";
            $Id("hyinfo").className = "out";
            $Id("shopinfo").style.display = "block";
            $Id("spinfo").style.display = "none";
            break;
        case 6:
            $Id("hyinfo").className = "on";
            $Id("ykinfo").className = "out";
            $Id("shopinfo").style.display = "none";
            $Id("spinfo").style.display = "block";
            break;

        case 7:
            $Id("ykinfo").className = "on";
            $Id("hyinfo").className = "out";
            $Id("contentBox3").style.display = "block";
            $Id("contentBox4").style.display = "none";
            break;
        case 8:
            $Id("hyinfo").className = "on";
            $Id("ykinfo").className = "out";
            $Id("contentBox3").style.display = "none";
            $Id("contentBox4").style.display = "block";
            break;
    }
}

//询价
function price(url) {
    window.location.href = url + "#message";
}
//联系方式
function relation(url) {
    window.location.href = url + "#link";
}

//查看图片
function selectimg(obj) {
    $Id("img").src = obj.src;
}
////==========================================================================
////  商业信息详细 结束
////==========================================================================

//function setuiname()
//{
//  var msg=$Id("_check").value.replace('<br/>','');
//  var Msgs= msg.split(","); 
//  if(Msgs[0]==1)
//   {
//    return alertmsg(false,'您的信息资料不完善,请您及时完善信息资料!',$Id("weburl").value +'user/edituserinfo.aspx');
//   }
//   else if(Msgs[1]==2)
//   {
//    return alertmsg(false,'您的信息资料没审核,请及时与管理员联系!',$Id("weburl").value +'index.aspx');  
//   }
//}

////==========================================================================
////  留言信息开始
////==========================================================================

function hrrewrite()//清空会员留言信息
{
	$Id("txtTitle").value = "";
	$Id("txtContent").value = "";
	$Id("userVCode").value = "";
	$Id('userVCodeImg').src = config.WebURL + "common/ValidateCode.ashx?" + Math.random();
}
function ykrewrite()//清空游客留言信息
{

	$Id("linkman").value="";
	$Id("email").value= "";

	$Id("mobile").value="";

	$Id("title").value = "";
	$Id("neirong").value="";
	$Id("guestVCode").value = "";
	$Id('guestVCodeImg').src = config.WebURL + "common/ValidateCode.ashx?" + Math.random();

	for(i=0;i<=16;i++) {
	    if($Id("txt"+i))
	        $Id("txt"+i).className="three";
	}	
}


function checkmessage() {
    if ($Id("companyname").value == "") { $Id("companyname").focus(); return false; }
    if ($Id("linkman").value == "") { $Id("linkman").focus(); return false; }
    if ($Id("email").value == "") { $Id("email").focus(); return false; }
    if ($Id("pqh").value == "") { $Id("pqh").focus(); return false; }
    if ($Id("phm").value == "") { $Id("phm").focus(); return false; }
    if ($Id("address").value == "") { $Id("address").focus(); return false; }
    if ($Id("title").value == "") { $Id("title").focus(); return false; }
    if ($Id("neirong").value == "") { $Id("neirong").focus(); return false; }

    if ($Id("txtTitle").value == "") { $Id("txtTitle").focus(); return false; }
    if ($Id("txtContent").value == "") { $Id("txtContent").focus(); return false; }
}


var txtobjmessage = new Array("companyname", "linkman", "email", "pgh", "pqh", "phm", "pfjh", "fgh", "fqh", "fhm", "ffjh", "mobile", "citytype", "address", "title", "neirong", "guestVCode", "bir", "door", "school", "spcia", "resume", "txtTitle", "txtContent");
	// 获取焦点时显示的文字
		var ty = new Array(24);    
	    ty[0] = "";
	    ty[1] = "";
	    ty[2] = "";
	    ty[3] = "";
	    ty[4] = "";
	    ty[5] = "";
	    ty[6] = "";
	    ty[7] = "";
	    ty[8] = "";
	    ty[9] = "";
	    ty[10] = "";
	    ty[11] = "";
	    ty[12] = "";
	    ty[13] = "";
	    ty[14] = "";
	    ty[15] = "";
	    ty[16] = "";
	    ty[17] = "";
	    ty[18] = "";
	    ty[19] = "";
	    ty[20] = "";
	    ty[21] = "";
	    ty[22] = "";
	    ty[23] = "";
//	    ty[0] = "Please enter company name";
//	    ty[1] = "Please enter your name";
//	    ty[2] = "Please enter E-mail";
//	    ty[3] = "Please enter country code";
//	    ty[4] = "Please enter Telephone area code";
//	    ty[5] = "Please enter Tephone";
//	    ty[6] = "Please enter extension";
//	    ty[7] = "Please enter country code";
//	    ty[8] = "Please enter fax area code";
//	    ty[9] = "Please enter fax";
//	    ty[10] = "Please enter extension";
//	    ty[11] = "Please enter telephone/cellphone number";
//	    ty[12] = "Please enter Region";
//	    ty[13] = "Please enter address";
//	    ty[14] = "Please enter subject";
//	    ty[15] = "Please enter content";
//	    ty[16] = "Please enter Verification code";
//	    ty[17] = "Please enter date";
//	    ty[18] = "Please enter resident location";
//	    ty[19] = "Please enter school";
//	    ty[20] = "Please enter major";
//	    ty[21] = "Please enter self-introduction";
//	    ty[22] = "Please enter subject";
//	    ty[23] = "Please enter content";
	    
	  // 所填信息错误时显示的文字
		var tx = new Array(22);
		tx[0] = "Please enter company name";
		tx[1] = "Please enter user name";
		tx[2] = "Your entered email is not correct.";
		tx[3] = "Please enter country code";
		tx[4] = "Please enter Telephone area code";
		tx[5] = "Please enter Tephone";
		tx[6] = "Please enter extension";
		tx[7] = "Please enter country code";
		tx[8] = "Please enter fax area code";
		tx[9] = "Please enter fax";
		tx[10] = "Please enter extension";
		tx[11] = "Your entered phone number/mobile is not correct.";
		tx[12] = "Please enter Region";
		tx[13] = "Please enter address";
		tx[14] = "Please enter 1-100 characters for subject";
		tx[15] = "Please enter 1-1000 characters for contents";
		tx[16] = "Please enter Verification code";
		tx[17] = "Please enter date";
		tx[18] = "Please enter resident location";
		tx[19] = "Please enter school";
		tx[20] = "Please enter major";
		tx[21] = "Please enter self-introduction";
		tx[22] = "Please enter 1-100 characters for subject";
		tx[23] = "Please enter 1-1000 characters for contents";
	    
		
		// 样式
		var cy = new Array(4);
		cy[0] = "three";	// 默认
		cy[1] = "cue";	// 获得焦点
		cy[2] = "right";	// 正确
		cy[3] = "wrong";	// 错误
		
		
		function getobjy(objName)
		{
			if ($Id) {return eval('$Id("'+ objName +'")');}
			else {return eval('document.all["'+ objName +'"]');}
		}
		// 获得焦点
		function fs(num)
		{
		  	var obj = "txt"+num;
			getobjy(obj).setAttribute("className",cy[1]);
			getobjy(obj).innerHTML =ty[num];
		
		}
		
		// 正确
		function oky(num)
		{   	     
			var obj = "txt"+num;
			getobjy(obj).setAttribute("className",cy[2]);
			getobjy(obj).innerHTML = "";
		}
		// 错误
		function errinfo(num)
		{
			var obj = "txt"+num;
			getobjy(obj).setAttribute("className",cy[3]);
			getobjy(obj).innerHTML =  tx[num];
		}
		
		function errinfo1(num,msg)
		{
		    var obj = "txt"+num;
			getobjy(obj).setAttribute("className",cy[3]);
			getobjy(obj).innerHTML =  tx[msg];
		}

		function checkinfo(num) {
		    var obj = "txt" + num;
		    var val = getobjy(txtobjmessage[num]).value; // 获取文本框的值

		    switch (num) {
		        case "0": //公司名称
		            if (val == "") errinfo(num);
		            else if (val.length > 200) errinfo(num);
		            else oky(num);
		            break;
		        case "1": // 联系人
		            if (val == "") errinfo(num);
		            else if (val.length > 50) errinfo(num);
		            else oky(num);
		            break;
		        case "2": // 电子邮件
		            if (val == "") errinfo(num);
		            else if (!ValidateEmail(val)) errinfo(num)
		            else oky(num); break;
		        case "3": //国号
		            if (val == "") errinfo1(num, num);
		            else if (val.length > 3) errinfo1(num, num);
		            else if (val.search(/^[-\+]?\d+$Id/) == -1) errinfo1(num, num);
		            else oky(num);
		            break;
		        case "4": //区号
		            if (val == "" || val.length < 3) errinfo1(3, num);
		            else if (val.search(/^[-\+]?\d+$Id/) == -1) errinfo1(3, num);
		            else oky(3);
		            break;
		        case "5": //号码
		            if (val == "") errinfo1(3, num);
		            else if (val.length < 7) errinfo1(3, num);
		            else if (val.search(/^[-\+]?\d+$Id/) == -1) errinfo1(3, num);
		            else oky(3);
		            break;
		        case "6": //分机号
		            if (val == "") oky(3);
		            else if (val.search(/^[-\+]?\d+$Id/) == -1) errinfo1(3, num);
		            else oky(3);
		            break;
		        case "7": //国号					
		            if (val.search(/^[-\+]?\d+$Id/) == -1) errinfo1(7, num);
		            else oky(7);
		            break;
		        case "8": //区号					
		            if (val != "" && val.length < 3 && val.search(/^[-\+]?\d+$Id/) == -1) errinfo1(7, num);
		            else oky(7);
		            break;
		        case "9": //号码
		            if (val != "" && val.length < 7 && val.search(/^[-\+]?\d+$Id/) == -1) errinfo1(7, num);
		            else oky(7);
		            break;
		        case "10": //传真分机号
		            if (val == "") oky(7);
		            else if (val != "" && val.search(/^[-\+]?\d+$Id/) == -1) errinfo1(7, num);
		            else oky(num);
		            break;
		        case "11": //电话或手机
		            if (val == "") errinfo(num);
		            else if (!ValidateMobileTel(val) && !ValidateTel(val)) errinfo(num);
		            else oky(num);
		            break;
		        case "12": //所在地区
		            if (val == "") errinfo(num);
		            else oky(num);
		            break;
		        case "13": //联系地址
		            if (val == "") errinfo(num);
		            else if (val.length > 200) errinfo(num);
		            else oky(num);
		            break;
		        case "14": //标题
		            if (val == "") errinfo(num);
		            else if (val.length > 100) errinfo(num);
		            else oky(num);
		            break;
		        case "15": //内容
		            if (getobjy(txtobjmessage[num]).innerHTML == "") errinfo(num);

		            else if (getobjy(txtobjmessage[num]).innerHTML.length > 1000) errinfo(num);
		            else oky(num);
		            break;
		        case "16": //验证码
		            if (val == "") errinfo(num);
		            else if (val.search(/^[-\+]?\d+$Id/) == -1) errinfo(num);
		            else oky(num);
		            break;

		        case "17": //日期
		            if (val == "") errinfo(num);
		            else if (val.length > 200) errinfo(num);
		            else oky(num);
		            break;
		        case "18": //户口
		            if (val == "") errinfo(num);
		            else if (val.length > 200) errinfo(num);
		            else oky(num);
		            break;
		        case "19": //学校
		            if (val == "") errinfo(num);
		            else if (val.length > 200) errinfo(num);
		            else oky(num);
		            break;
		        case "20": //专业
		            if (val == "") errinfo(num);
		            else if (val.length > 200) errinfo(num);
		            else oky(num);
		            break;
		        case "21": //简历
		            if (val == "") errinfo(num);
		            else if (val.length > 200) errinfo(num);
		            else oky(num);
		            break;
		        case "22": //会员主题
		            if (val == "") {
		                errinfo(num);
		            }
		            else if (val.length > 100)
		            { errinfo(num); }
		            else oky(num);
		        case "23": //会员内容
		            if (val == "")
		            { errinfo(num); }
		            else if (val.length > 1000) { errinfo(num); }
		            else { oky(num); }
		            break;

		    }
		}
function IsNotNull(source, num) {

    if (jtrim($Id(source).value) == "") {
        checkinfo(num);
        return false;
    }
    return true;
}

function checkmessage() {
    
    if (!IsNotNull("linkman", "1")) return false;
    if (!IsNotNull("email", "2")) return false;

    //alert($Id("email").value);
    if (!ValidateEmail($Id("email").value)) {
        checkinfo("2");
        return false;
    }
    
    if (!IsNotNull("mobile", "11")) return false;
    if (!ValidateMobileTel($Fvalue("mobile")) && !ValidateTel($Fvalue("mobile"))) {
        checkinfo("11");
        return false;
    }
    if (!IsNotNull("title", "14")) return false;
    if (!IsNotNull("neirong", "15")) return false;
    if ($Fvalue("neirong").length > 100) {
        alertmsg(false, "use 100 characters or less ");
        return false;
    }
    
    if ($Id("guestVCode")) {
        if (!IsNotNull("guestVCode", "16")) return false;
    }

    addmessageae();
}

function messagets(mess, num) {
    for (i = 0; i < 6; i++) {
        $Id("d" + i).style.display = "none";
    }
    $Id("d" + num).style.display = "block";
    $Id("d" + num).innerHTML = "<img src='images/error.gif' />&nbsp;&nbsp;" + mess;
}

function messagetss() {
    for (i = 0; i < 6; i++) {
        $Id("d" + i).style.display = "none";
    }
}
var pd = "";

//去两端空格
function jtrim(sstr) {

	var astr="";
	var dstr="";
	var flag = 0;
	for (i = 0; i < sstr.length; i++) {
	    if ((sstr.charAt(i) != ' ') || (flag != 0)) {
	        dstr += sstr.charAt(i);
	        flag = 1;
	    }
	}
	flag=0;
	for (i=dstr.length-1;i>=0;i--)
		{if ((dstr.charAt(i)!=' ')||(flag!=0)) 
		{astr+=dstr.charAt(i);
		 flag=1; 
			}
		}
	dstr="";
	for (i = astr.length - 1; i >= 0; i--) dstr += astr.charAt(i);
	return dstr;
}

function checkmessagebox(j) {
    switch (j) {
        case 0:
            if (jtrim($Id("message").value) == "" || $Id("message").value == $Id("message").defaultValue) {
                $Id("message").style.borderColor="#ff0000"
             //   messagets("Please enter the comment", 0);
                return false;
            }
            else {
                messagetss();
                pd = "1";
            }
            break;
        case 1:
            if (jtrim($Id("linkman").value )== "" || $Id("linkman").value == $Id("linkman").defaultValue) {
                $Id("linkman").style.borderColor = "#ff0000"
               // messagets("contact person information is incorect", 1);
                return false;
            }
            else {
                messagetss();
                pd = "12";
            }
            break;
        case 2:
            if (jtrim($Id("linkph").value) =="" || (!ValidateMobileTel($Fvalue("linkph")) && !ValidateTel($Fvalue("linkph")))) {
                $Id("linkph").style.borderColor = "#ff0000"
               // messagets("contact telephone number is incorrect", 2);
                //parent.alertmsg(false, "联系方式填写错误!",2);
                return false;
            }
            else {
                messagetss();
                pd = "123";
            }
            break;
        case 3://&& $Id("Email").value != $Id("Email").defaultValue
            if ($Id("Email").value != "" ) {
                if (!ValidateEmail($Id("Email").value)) {
                    $Id("Email").style.borderColor = "#ff0000"
                   // messagets("Email is incorrect", 3);
                    //parent.alertmsg(false, "Email填写错误!",3);
                    return false;
                }
                else {
                    messagetss();
                    pd = "123";
                }
            };
            break;
        case 4:
            if ($Fvalue("QQ") != "");
            {
                if (isNaN($Fvalue("QQ"))) {
                    $Id("QQ").style.borderColor = "#ff0000"
                   
                 //   messagets("Please input QQ!", 4);
                    return false;
                }
                else {
                    messagetss();
                    pd = "123";
                }
            }
            break;
        case 5:
            if ($Fvalue("code") == "") {
                $Id("code").style.borderColor = "#ff0000"
               // messagets("Please enter the verification code", 5);
                return false;
            }
            else if ($Id("message").value == "" || $Id("message").value == $Id("message").defaultValue) {
            $Id("message").style.borderColor = "#ff0000"
          //  messagets("Please enter the comment", 0);
                return false;
            }
            else {
                messagetss();
                pd = "123456";
            }
            break;
        default:
            for (i = 0; i < 6; i++) {
                $Id("d" + i).style.display = "none";
            }
    }
}

function UserMessageInit() {
    $Id("txtTitle").value = $Id("title").value = $Fvalue("_param_message_title");
    var module = $Fvalue("_param_message_module");
    if (module != "") {
        var ajax = new Ajax("xy036", "&module=" + module);
        ajax.onSuccess = function() {
            if (ajax.state.result == "1") {
                var html1 = "";
                var html2 = "";
                for (var imsg = 0; imsg < ajax.data.msglist.length; imsg++) {
                    html1 += "<input type =\"checkbox\"  value =\"" + ajax.data.msglist[imsg].title + "\"  name =\"symess\" onclick =\"getsystemmessage();\"/>" + ajax.data.msglist[imsg].title + "<br />";
                    html2 += "<input type =\"checkbox\"  value =\"" + ajax.data.msglist[imsg].title + "\"  name =\"symessuser\" onclick =\"getusersystemmessage();\"/>" + ajax.data.msglist[imsg].title + "<br />";
                }
                $Id("ks1").innerHTML = html1;
                $Id("ks2").innerHTML = html2;
            }
        }
    }
}


function addmessageae()//添加留言
{
    sAlert(XY_LOADING, "", false);
    var url = "";
    url += "&linkman=" + escape($Fvalue("linkman"));
    url += "&email=" + escape($Fvalue("email"));
    url += "&mobile=" + escape($Fvalue("mobile"));
    url += "&title=" + escape($Fvalue("title"));
    url += "&neirong=" + escape($Fvalue("neirong"));
    //url += "&usertype="+escape($Fvalue("usertype"));
    url += "&sex=" + ($Id("nsex").checked ? "1" : "0");
    url += "&type=offer" //+ escape($Fvalue("_param_message_parent_module"));
    url += "&ids=" + escape($Fvalue("_param_message_infoid"));
    if ($Id("guestVCode")) {
        url += "&GCode=" + escape($Fvalue("guestVCode"));
    }
    url += "&uids=" + escape($Fvalue("_param_message_userid"));
    var ajax = new Ajax("xy011", url);
    ajax.onSuccess = function() {
        if (ajax.state.result == "1") {
            if (ajax.data.content == "codeErr") {
                alertmsg(false, "verification code is incorrect");
                $Id("guestVCodeImg").src = $Id("userVCodeImg").src = GetNewCode();
                $Id("guestVCode").focus();
                return false;
            }
            else if (ajax.data.content == "ok") {
            alertmsg(false, "Success! The receiver will see your comment when signed in.");
                ykrewrite(); //清空表单
            }
            else if (ajax.data.content == "err") {
            alertmsg(false, "fail");
                return false;
            }
            else {
                alertmsg(false, "fail");
            }
        }
    }
}

function addmessagebox()//留言盒子添加留言
{
            if (jtrim($Id("message").value) == "" || $Id("message").value ==$Id("message").defaultValue) {
                $Id("message").style.borderColor = "#ff0000"
                //messagets("Please enter the comment", 0);
                return false;
            }
         
      
            if (jtrim($Id("linkman").value )== "" || $Id("linkman").value == $Id("linkman").defaultValue) {
                $Id("linkman").style.borderColor = "#ff0000"
                //messagets("contact person information is incorect", 1);
                return false;
            }
          
      
            if (jtrim($Id("linkph").value) =="" || (!ValidateMobileTel($Fvalue("linkph")) && !ValidateTel($Fvalue("linkph")))) {
                $Id("linkph").style.borderColor = "#ff0000"
                //messagets("contact telephone number is incorrect", 2);          
                return false;
            }
         
    
            if ($Id("Email").value != "" ) {
                if (!ValidateEmail($Id("Email").value)) {
                    $Id("Email").style.borderColor = "#ff0000"
                    //messagets("Email is incorrect", 3);                   
                    return false;
                }               
            }
          
   
            if ($Id("QQ").value != "");
            {
                if (isNaN($Id("QQ").value)) {
                    $Id("QQ").style.borderColor = "#ff0000"
                    //messagets("Please enter QQ number!", 4);
                    return false;
                }            
            }
       
            if ($Id("code").value == "") {
                $Id("code").style.borderColor = "#ff0000"
                //messagets("Please enter the verification code.", 5);
                return false;
            }
         
             
 var url = "";
        url += "&linkman=" + escape($Fvalue("linkman"));
        url += "&email=" + escape($Fvalue("Email"));
        url += "&mobile=" + escape($Fvalue("linkph"));
        url += "&title=" + escape($Fvalue("message"));
        url += "&neirong=" + escape($Fvalue("message"));       
        url += "&type=user";      
        if ($Id("vCodeImg")) {
            url += "&GCode=" + escape($Fvalue("code"));
        } 
        url += "&uids=" + escape($Fvalue("userid"));
        var ajax = new Ajax("xy041", url);
        ajax.onSuccess = function() {
        if (ajax.state.result == "1") {
                if (ajax.data.content == "codeErr") {
                    messagets("verification code is incorrect.", 5);
                    //parent.alertmsg(false, "验证码有误!");
                    $Id("vCodeImg").src = GetNewCode();
                    $Id("vCodeImg").focus();
                    return false;
                }
                else if (ajax.data.content == "ok") {
                parent.alertmsg(false, "Success! The receiver will see your comment when signed in.");
                    $Id("vCodeImg").src = "/Common/ValidateCode.ashx?=" + Math.random();
                    $Id("code").value = "";
                    //ykrewritebox(); //清空表单
                }
                else if (ajax.data.content == "err") {
                parent.alertmsg(false, "fail");
                    return false;
                }
                else {
                    parent.alertmsg(false, "fail");
                }
            }
        }
}

function ykrewrite()//清空游客留言信息
{

    $Id("linkman").value = "";
    $Id("email").value = "";

    $Id("mobile").value = "";

    $Id("neirong").value = "";
    $Id("guestVCode").value = "";
    $Id('guestVCodeImg').src = config.WebURL + "common/ValidateCode.ashx?" + Math.random();

    for (i = 0; i <= 16; i++) {
        if ($Id("txt" + i))
            $Id("txt" + i).className = "three";
    }
    $Id("title").value = $Id("messageinfotitle").value;
}



function ykrewritebox()//清空游客留言信息
{

    $Id("linkman").value = $Id("linkman").defaultValue;
    $Id("Email").value = $Id("Email").defaultValue;

    $Id("linkph").value = $Id("linkph").defaultValue;

    $Id("message").value = $Id("message").defaultValue;
    $Id("QQ").value = $Id("QQ").defaultValue;
 }



 function checkusermessage() {

   //  var content = FCKeditorAPI.GetInstance('txtContent').GetXHTML(true);
     var content = $Fvalue("txtContent");
    if ($Fvalue("txtTitle") == "") {
        $Id("txtTitle").focus();
    }
    else if ($Fvalue("txtTitle").length > 500) {
    $Id("txtTitle").focus();
    return alertmsg(false, '1-500 characters for subject');
    }
    else if (content == "") {
        return alertmsg(false, 'Detailed Description is required.');
    }
    else if ($Id("userVCode") && $Fvalue("userVCode") == "") {
    $Id("userVCode").focus();
    return false;
    }
    else {
        addusermedssage();
    }
}
function addusermedssage() {
    //var content = FCKeditorAPI.GetInstance('txtContent').GetXHTML(true);
    var content = $Fvalue("txtContent");
    var str_url = window.location.href;
    sAlert(XY_LOADING, "", false);
    var url = "";
    url += "&content=" + escape(content);
    if ($Id("userVCode")) {
        url += "&code=" + $Id("userVCode").value;
    }
    url += "&title=" + $Id("txtTitle").value;
    url += "&type=" + $Id("_param_message_parent_module").value;
    url += "&ids=" + $Id("_param_message_infoid").value;
    url += "&uids=" + $Id("_param_message_userid").value;

    var ajax = new Ajax("xy012", url);
    ajax.onSuccess = function() {
        if (ajax.state.result == "1") {
            if (ajax.data.content == "codeErr") {
                alertmsg(false, "verification code is incorrect.");
                $Id("userVCode").value = "";
                $Id("userVCode").focus();
                $Id("userVCodeImg").src = $Id("guestVCodeImg").src = GetNewCode();
                return false;
            }
            else if (ajax.data.content == "ok") {
            alertmsg(false, "Success! The receiver will see your comment when signed in.");
                hrrewrite(); //清空表单
            }
            else if (ajax.data.content == "nologin") {
            alertmsg(false, 'you are not signed in!', config.WebURL + 'login.' + config.Suffix + '?surl=' + escape(str_url));
            }
            else if (ajax.data.content == "nomessage") {
            alertmsg(false, "can not send comment to  yourself!");
            }
            else if (ajax.data.content == "err") {
            alertmsg(false, 'fail');
            }
        }
    }
}


function gettephone()
{
$Id("fgh").value=$Id("pgh").value;
$Id("fqh").value=$Id("pqh").value;
$Id("fhm").value=$Id("phm").value;
$Id("ffjh").value=$Id("pfjh").value;
}



function getsystemmessage()
{
 var info="";
 var chkother= document.getElementsByName("symess");
	for (var i=0;i<chkother.length;i++)
	{
		if( chkother[i].type=='checkbox')
		{
			
		    if(chkother[i].checked == true)
			{
                	 info+=chkother[i].value+'\n';  				
			}
			
		}
	}
$Id("neirong").value=info;
                                        		    				
}

function getusersystemmessage()
{
var messinfo="";
 var chkother= document.getElementsByName("symessuser");
	for (var i=0;i<chkother.length;i++)
	{
		if( chkother[i].type=='checkbox')
		{
			
		    if(chkother[i].checked == true)	
                     {
                        messinfo+=chkother[i].value+'\n';
                    }		
			
		}
	}

    $Id("txtContent").value=messinfo;                         		    				
}

////==========================================================================
////
////  留言信息 结束
////
////==========================================================================

//收藏岗位信息
function getjobinfo()
{
 var chk= document.getElementsByTagName("input");
    var ids = "";
      var num = 0;
    for (var i=0;i<chk.length;i++)
	{
		if( chk[i].type=='checkbox')
		{
			if(chk[i].checked == true)
			{
			    ids += ","+chk[i].value;
			    num++;
			}
		}
	} 
	if(num==0)
    {
        return alertmsg(false, "Select one or more records to your favorites!");
    }  
    else
    { 
    $Id("ids").value=ids.substring(1);
    Favorite()
    }
}
////==========================================================================
////
////  收藏信息 开始
////
////==========================================================================
function Favorite()	{
    var str_url =escape(window.location.href);
    var ajax = new Ajax("xy023","&Module="+$Fvalue("_param_userinfo_parent_module")+"&InfoId="+$Fvalue("_param_userinfo_infoid")+"&UserId="+$Fvalue("_param_userinfo_userid"));
    ajax.onSuccess = function() {
        if (ajax.state.result == "1") {
            if (ajax.data.content == "nologin") {
                window.location.href = config.WebURL + 'login.' + config.Suffix + '?surl=' + str_url;
                // alertmsg(false, "You are not signed in, please sign in first.", config.WebURL + 'login.' + config.Suffix + '?surl=' + str_url);	
            }
            else if (ajax.data.content == "ok") {
                alertmsg(false, "Has been added to My Favorites successfully.");
            }
            else if (ajax.data.content == "err") {
                alertmsg(false, "Add to your favorites failed");
            }
            else if (ajax.data.content == "exis") {
                alertmsg(false, "Sorry, has already been added to My Favorites.");
            }
            else if (ajax.data.content == "nomessage") {
                alertmsg(false, "can not add your onw posted information to your favorites!");
            }
            else {
                alertmsg(false, 'System abnormal! please try again later.');
            }
        }
    }
}
////==========================================================================
////
////  收藏信息 结束
////
////==========================================================================

/*==========================================================================
浏览信息增加点击量 开始 
pageModule：页面标识
Module:模块名称
infoID:信息Id
userID:用户Id
isUp:是否更新浏览次数(可选，1：更新，0：不更新；默认为1)

tc 2008-11-27 modify
=======================================================================*/
function GetClickNum(pageModule, Module, infoID, userID, isUp) {
    var strhref = "";

    strhref += "&Page=" + pageModule;
    strhref += "&Module=" + Module;
    strhref += "&InfoId=" + infoID;
    strhref += "&UId=" + userID;


    if (undefined == isUp)
        isUp = 1;

    strhref += "&isUp=" + isUp;

    var ajax = new Ajax("XY013", strhref);
    ajax.onSuccess = function() {

        if (ajax.state.result == "1") {

            if (ajax.data.pause == "1") {

                try {
                    $Id("clicknum").innerHTML = ajax.data.clicknum;
                    $Id("messnum").innerHTML = ajax.data.messagenum;
                }
                catch (e) { }

                if (ajax.data.linktype == "1")//可以查看联系方式
                {
                    if (ajax.data.userinfo == undefined) return;

                    //---------------- 页面下方企业联系方式
                    //                    var strConteacts = "";                 
                    //                    strConteacts += "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
                    //                    strConteacts += "<tr>";
                    //                    strConteacts += "<td style=\"padding-bottom: 6px;\">";
                    //                    strConteacts += "<h3>";
                    //                    strConteacts += "<a href=\"" + ajax.data.userinfo[0].shopindex + "\" id=\"userpage\">" + ajax.data.userinfo[0].uiname + "</a>";
                    //                    strConteacts += "<span style=\"color: #666; margin:0 2px;\">" + ajax.data.userinfo[0].area; +"&nbsp;";
                    //                    strConteacts += "<img src=\"/upload/" + ajax.data.userinfo[0].at_path + "\" align=\"absmiddle\" style='margin:0 2px' />";
                    //                    strConteacts += "</span>";
                    //                    strConteacts += "</h3>";
                    //                    strConteacts += "</td>";
                    //                    strConteacts += "</tr>";
                    //                    strConteacts += "<tr>";
                    //                    strConteacts += "<td>";
                    //                    strConteacts += "Contact Person:<strong> " + ajax.data.userinfo[0].linkman + "</strong>";
                    //                    strConteacts += "</td>";
                    //                    strConteacts += "</tr>";
                    //                    strConteacts += "<tr>";
                    //                    strConteacts += "<td>";
                    //                    strConteacts += "Mobile:<strong> " + ajax.data.userinfo[0].mobile + "</strong>";
                    //                    strConteacts += "</td>";
                    //                    strConteacts += "</tr>";
                    //                    strConteacts += "<tr>";
                    //                    strConteacts += "<td>";
                    //                    strConteacts += "Telephone:<strong> " + ajax.data.userinfo[0].telephone + "</strong>";
                    //                    strConteacts += "</td>";
                    //                    strConteacts += "</tr>";
                    //                    strConteacts += "<tr>";
                    //                    strConteacts += "<td height=\"22\" style=\"padding-bottom: 10px;\">";
                    //                    strConteacts += "<img src=\"/templates/EN2010/images/icon/check_c.gif\" align=\"absmiddle\" />&nbsp;&nbsp;<a href=\"" + ajax.data.userinfo[0].shopindex + "/contact.html\" target=\"_blank\" style=\"color: #669\">Contact Details</a>";
                    //                    strConteacts += "</td>";
                    //                    strConteacts += "</tr>";
                    //                    strConteacts += "<tr>";
                    //                    strConteacts += "<td>";
                    //                    strConteacts += "<div align=\"center\" style=\"padding: 10px; border-top: 1px dashed #CCC\">";
                    //                    strConteacts += "<a href=\"" + ajax.data.userinfo[0].shopindex + "\" target=\"_blank\">";
                    //                    if (pageModule == "buyoffer")
                    //                        strConteacts += "<img src=\"/templates/EN2010/images/btn/bt_back_web.gif\" /></a></div>";
                    //                    else
                    //                        strConteacts += "<img src=\"/templates/EN2010/images/btn/bt_back_web1.gif\" /></a></div>";
                    //                    strConteacts += "</td>";
                    //                    strConteacts += "</tr>";
                    //                    strConteacts += "</table>";


                    var strConteacts = "";



                    strConteacts += "<table width=\"100%\" cellspacing=\"1\" cellpadding=\"1\" border=\"0\" align=\"center\">";
                    strConteacts += "<tbody>"
                    strConteacts += "<tr>";

                    strConteacts += "<td class=\"typetitle\" width='20%'>Company Name:</td>";
                    strConteacts += "<td width='80%'><a href=\"";
                    strConteacts += ajax.data.userinfo[0].shopindex;
                    strConteacts += "\" class=\"link14\"";
                    strConteacts += ">" + ajax.data.userinfo[0].uiname + "</a></td>";
                    strConteacts += "</tr>";

                    strConteacts += "<tr>";
                    strConteacts += "<td  class=\"typetitle\">Contact Person:</td>";
                    strConteacts += "<td >" + (ajax.data.userinfo[0].sex == 'False' ? 'Mr' : 'Ms') + '. ' + ajax.data.userinfo[0].linkman + "</td>";
                    strConteacts += "</tr>";
                    if (ajax.data.userinfo[0].telephone.length > 2) {
                        strConteacts += "<tr>";
                        strConteacts += "<td  class=\"typetitle\">Tel:</td>";
                        strConteacts += "<td >";
                        strConteacts += ajax.data.userinfo[0].telephone;
                        strConteacts += "</td>";
                        strConteacts += "</tr>";
                    }
                    if (ajax.data.userinfo[0].mobile.length > 2) {
                        strConteacts += "<tr>";
                        strConteacts += "<td  class=\"typetitle\">Mobile:</td>";
                        strConteacts += "<td >";
                        strConteacts += ajax.data.userinfo[0].mobile;
                        strConteacts += "</td>";
                        strConteacts += " </tr>";
                    }
                    if (ajax.data.userinfo[0].fax.length > 2) {
                        strConteacts += "<tr>";
                        strConteacts += " <td  class=\"typetitle\">Fax:</td>";
                        strConteacts += "<td > ";
                        strConteacts += ajax.data.userinfo[0].fax;
                        strConteacts += "</td>";
                        strConteacts += "</tr>";
                    }

                    //                    strConteacts += "<tr>";
                    //                    strConteacts += "<td  class=\"typetitle\">Email:</td>";
                    //                    strConteacts += "<td >" + ajax.data.userinfo[0].email + "</td>";
                    //                    strConteacts += " </tr>";

                    strConteacts += "<tr>";
                    strConteacts += "<td  class=\"typetitle\">Website:</td>";
                    strConteacts += "<td ><a href=\"" + ajax.data.userinfo[0].siteurl + "\"target =\"_blank\">" + ajax.data.userinfo[0].siteurl + "</a></td>";
                    strConteacts += " </tr>";

                    strConteacts += "<tr>";
                    strConteacts += " <td  class=\"typetitle\" width='10%'>Address:</td>";
                    strConteacts += " <td >" + ajax.data.userinfo[0].address + "</td>";
                    strConteacts += " </tr>";


                    strConteacts += "</table>";


                    $Id("linkmessage").innerHTML = strConteacts;

                    if (pageModule != "company") {
                        $Id("loginnouser").style.display = "none";
                        $Id("UserNoLogin").style.display = "none";
                        $Id("loginuser").style.display = "block";

                        //显示联系方式
                        $Id("loginuseruginfo").innerHTML = "<img src=\"" + ajax.data.userinfo[0].uimgurl + "\" alt=\"\"/>" + ajax.data.userinfo[0].uname;

                        //公司名称以及链接
                        $Id("loginuserurl").href = ajax.data.userinfo[0].uhtmlpage;
                        $Id("loginuserurl").innerHTML = ajax.data.userinfo[0].uiname;
                        //公司简介链接
                        $Id("UserIntro").href = ajax.data.userinfo[0].uhtmlpage;

                        //$Id("userShopUrl").href = msgvalues[2];
                        $Id("ConsummatePercent").innerHTML = ajax.data.userinfo[0].ureginformation + "%";
                        $Id("PercentForImg").width = ajax.data.userinfo[0].uinformation;
                        $Id("loginuseryearnum").innerHTML = ajax.data.userinfo[0].year;


                        //性别
                        //联系人
                        $Id("sex").innerHTML = ajax.data.userinfo[0].sex;
                        //联系人
                        $Id("LinkManName").innerHTML = ajax.data.userinfo[0].UI_SuLinkMan;
                        //诚信档案
                        $Id("GoodFaithFile").href = ajax.data.userinfo[0].goodFaithFile;
                        //最新供应
                        $Id("NewOfferPage").href = ajax.data.userinfo[0].newOfferPage;
                        //联系我们
                        $Id("Contact").href = ajax.data.userinfo[0].contact;
                        //给我留言
                        $Id("memessage").href = ajax.data.userinfo[0].contact;
                        //联系方式
                        $Id("linkme").href = ajax.data.userinfo[0].contact;

                        //QQ在线
                        if (ajax.data.userinfo[0].userIM != "") $Id("IMOnline").innerHTML = ajax.data.userinfo[0].userIM;
                    }
                }
                else if (ajax.data.linktype == "0") {
                    $Id("linkmessage").innerHTML = "<span>can not check the contact information with current username</span>";

                    if (pageModule != "company") {
                        $Id("loginnouser").style.display = "block";
                        $Id("UserNoLogin").style.display = "none";
                        $Id("loginuser").style.display = "none";

                        if (ajax.data.userinfo != undefined) {
                            //不显示联系方式
                            $Id("loginnouseruginfo").innerHTML = "you are " + ajax.data.userinfo[0].uname + ",can not check the contact information.";
                        }
                    }
                }
                else if (ajax.data.linktype == "-1") {

                    if (pageModule != "company") {
                        $Id("loginnouser").style.display = "none";
                        $Id("UserNoLogin").style.display = "";
                        $Id("loginuser").style.display = "none";
                    }
                    $Id("linkmessage").innerHTML = "<span>can not check the contact information with current username</span>";
                }
                return false;
            }
            else if (ajax.data.pause == "0") {

                window.location.href = config.WebURL + "Redirect." + config.Suffix + "?msg=0";
            }
            else {
                window.location.href = config.WebURL + "Redirect." + config.Suffix + "?msg=-1";
            }
        }
    }
}
////==========================================================================
////
////  浏览信息增加点击量 结束
////
////==========================================================================

////==========================================================================
////
////  浏览简历
////
////==========================================================================
function GetResume(infoID){
    var strhref = "";
    var str = "";
	strhref +="&InfoId=" + infoID;
    var ajax = new Ajax("xy037",strhref);
    ajax.onSuccess = function() {
        if("1" == ajax.state.result)
        {       
          if(ajax.data.linktype=="1")//可以查看联系方式
          { 
            str += "<table style=\"text-align:center;\">";
            str += "<caption style=\"text-align:left; font-size:16px;font-weight:bold;\">Personal information</caption>";
            str += "<tr>";
            str += "<td class=\"typetitle\">real name:</td>";
            str += "<td>" + ajax.data.userinfo[0].uname + "</td>";
            str += "<tr>";
            str += "<td  class=\"typetitle\">E-mail:</td>";
            str += "<td>" + ajax.data.userinfo[0].email + "</td>";
            str += "</tr>";
            str += "<tr>";
            str += "<td  class=\"typetitle\">Telephone:</td>";
            str += "<td>" + ajax.data.userinfo[0].tel + "</td>";
            str += "</tr>";
            str += "<tr>";
            str += "<td  class=\"typetitle\">Mobile:</td>";
            str += "<td>" + ajax.data.userinfo[0].mobil +"</td>" ;
            str += "</tr>";
            str += "<tr>";
            str += "<td  class=\"typetitle\">Address:</td>";
            str += "<td>" + ajax.data.userinfo[0].address + "</td>";
            str += "</tr>";
            str += "<tr>";
            str += " <td  class=\"typetitle\">ID:</td>";
            str += "<td>" + ajax.data.userinfo[0].code + "</td>";
            str += " </tr>";
            str += "</table>";

            $Id("linkmessage").innerHTML=str;  
          }
          else if(ajax.data.linktype=="0")
          {
              $Id("linkmessage").innerHTML = "<span style=\"font-weight:bold;\">can not check the contact information with current username.</span>";    
          }
          else if(ajax.data.linktype=="-1")
          {
              $Id("linkmessage").innerHTML = "<span style=\"font-weight:bold;\">can not check the contact information with current username.</span>"; 
          }    
            return false;
        }
        else
        {
            
        }
    }
}


////==========================================================================
////
////  留言信息设置 开始
////
////==========================================================================

function getMessageinfo(title,content)
{
$Id("txtTitle").value=title;
$Id("txtContent").value=content;
}
////==========================================================================
////
////  留言信息设置 结束
////
////==========================================================================




////==========================================================================
////
////  交易开始
////
////==========================================================================
function getMoney(obj)
{
    var ProductPrice=$Id("ProductPrice").value;
	var ProductSmallNum=$Id("ProductSmallNum").value;   
    var OrderMoney=$Id("OrderMoney");
    if(!isFinite(parseFloat(obj.value)))
    {    
	  obj.value=ProductSmallNum;
	  obj.focus();
	  return alertmsg(false, "Please enter a valid number.");
       
    } 
	else if(parseFloat(obj.value)<parseFloat(ProductSmallNum))
	{	 
	  obj.varue=ProductSmallNum;
	  obj.focus();
	  return alertmsg(false, "The minium purchasing quantity is" + ProductSmallNum);   
	}
	else
	{      
      OrderMoney.innerHTML=parseFloat(obj.value)*parseFloat(ProductPrice);
	}
    
}
/*20080607 TC*/
function InsertOrder()
{
    var number=$Id("txtNumber");   
    var linkMan=$Id("txtLinkMan");
    var linkAddress=$Id("txtLinkAddress");
	var linkTelphone=$Id("txtLinkTelphone");
	    
    var msgs ='';
	var flag = true;
	var foucuse = null;

	if (number.value == "") { msgs = "PLease fill in the quantity!"; foucuse = $Id("txtNumber"); flag = false; }
   
    if($Id("vcode") && $Id("vcode").value=="")  
    {
        if (flag) { msgs = "Please enter verification code!"; foucuse = code; flag = false; }
        else{msgs+="</br>Please enter verification code!";flag=false;}
    }
    
    if(linkAddress.value=="")
    {
        if (flag) { msgs = "Please enter destination!"; foucuse = linkAddress; flag = false; }
        else { msgs += "</br>Please enter destination!"; flag = false; }
    }
    
    if(linkMan.value=="")
    {
        if (flag) { msgs = "Please enter contact person!"; foucuse = linkMan; flag = false; }
        else { msgs += "</br>Please enter contact person!"; flag = false; }
    } 
    
    if(linkTelphone.value=="")
    {
        if (flag) { msgs = "Please enter telephone!"; foucuse = linkTelphone; flag = false; }
        else { msgs += "</br>Please enter telephone!"; flag = false; }
    }
    else
    {
        var telephone = linkTelphone.value;
        telephone = ReplaceAll(telephone,'.',',');
    
        var teles = telephone.split(",");
        
        for(var i=0;i<teles.length;i++){
            if(!ValidateTel(teles[i])){
                msgs += "Telephone format is not correct";    
                break;
            }
        }
    }
        
    if(flag){AddOrder();}
    else{return alertmsg(false,msgs);}
}

function AddOrder()
{
    var sd_id       =$Fvalue("cp_id") ;
    var Number      =$Id("txtNumber").value;
    var linkMan     =$Id("txtLinkMan").value;
    var linkTelphone =$Fvalue("txtLinkTelphone");  
    var linkAddress =$Id("txtLinkAddress").value;
    var code ="";
    
    try{code=$Fvalue("vcode");}catch(e){}
	var url         ="&infoId="+sd_id+"&code="+code+"&number="+Number+"&linkMan="+linkMan+"&linkAddress="+linkAddress+"&linkTelphone="+linkTelphone;
	
	var ajax = new Ajax("XY022",url);
    sAlert(XY_LOADING);
    
    ajax.onSuccess = function(){
        sAlert(ajax.state.message);
        if(ajax.state.result ==1)
            window.location.href = config.WebURL +"user/orderbuylist."+config.Suffix;
        else
            $Id("imgs").src=GetNewCode();  	  
    }
}
////==========================================================================
////
////  交易结束
////
////==========================================================================


////==========================================================================
////
////  投简历        开始
////
////==========================================================================
//验证
function validator(obj)
{
  var objmsg=obj+msg;
}

/*
* TC 20080516
* liujia 20080610
*/
function ApplyJob()
{
    var ajax = new Ajax("XY027","&eid=" + $Fvalue("JobId"));
    ajax.onSuccess =function(){
        if(ajax.state.result == "1")
        {
            if(ajax.data.content == "nologin")
            {
                window.location.href =config.WebURL +'login.'+config.Suffix+'?surl='+escape(window.location.href);
                return false; 
            }

            if (ajax.data.content == "ok") { alertmsg(false, "Resume sending success!"); return false; }
            if (ajax.data.content == "exists") { alertmsg(false, "Application failed! You have already applied for the position!"); return false; }
            if (ajax.data.content == "self") { alertmsg(false, "Application failed! This is your sent position! "); return false; }
            if (ajax.data.content == "company") { alertmsg(false, "You are an enterprise user, can not apply for position!"); return false; }
            if (ajax.data.content == "resume") { alertmsg(false, "Application failed! your resume hasn't been completed!"); return false; }

            alertmsg(false, "sending failed! Please try again later! "); return false;
        }
    }
}


function CommendJob()
{    
    var fromEmail=$Id("txtFromEmail").value ;
    var toEmail=$Id("txtToEmail").value ;
    var fromName=$Id("txtFromName").value ;
    
    var msg="",flag=true;    
    var emails=toEmail.split(",")

    if (fromName == "") { msg = "Please enter your name."; flag = false; }
	if(fromEmail=="")
	{
	    if (flag) { flag = false; msg = "Please enter your email."; }
	    else { flag = false; msg += "<br/>Please enter your email."; }
	}
    else if(!ValidateEmail(fromEmail))
    {
        if (flag) { flag = false; msg = "E-mail format is not correct."; }
        else { flag = false; msg += "<br/>E-mail format is not correct!"; }
    }
    if(toEmail!="")
    {
       for(var i=0;i<emails.length;i++)
       {
          if(!ValidateEmail(emails[i])){flag= false;msg+="<br/>"+emails[i];}      
       }
       if(!flag)
       {
           msg += "<br/>E-mail format is not correct!";
       }
    }
    else
    {
        if (flag) { flag = false; msg = "Please enter your friend's email."; }
        else { flag = false; msg += "<br/>Please enter your friend's email."; }    
    }  
    
    if(!flag){alertmsg(false,msg);return false;}
    
    var jobUrl=window.location.href;
    var jobName=$Id("txtjobname").value;

    sAlert("Sending, please wait...<br /><img src='/common/images/ajax-loader.gif' />");
    
    var ajax = new Ajax("XY028","&FromEmail="+fromEmail+"&ToEmail="+toEmail+"&JobUrl="+jobUrl+"&JobName="+jobName+"&FromName="+fromName);
    ajax.onSuccess =function(){
        if(ajax.state.result == "1")
        {
            sClose();
            if(ajax.data.content == "nologin")
            {
                window.location.href = config.WebURL+'login.'+config.Suffix+'?surl='+escape(window.location.href);
                return false; 
            }

            if (ajax.data.content == "ok") { alertmsg(false, "Recommend Success.", window.location.href); return false; }
            if (ajax.data.content == "err") { alertmsg(false, "The system mail server configurations error, Failed!"); return false; }

            alertmsg(false, "sending failed! No mail server configurations!"); return false;
        }
    }
}
function emptycommend()
{
     $Id("txtFromEmail").value='' ;
     $Id("txtToEmail").value='' ;
     $Id("txtFromName").value='' ;
}
////==========================================================================
////  投简历       结束
////==========================================================================

////==========================================================================
////  关键字竞价 开始
////==========================================================================

function getsearchkeylist()
{
   if($Id("tbsearchkey").value == "")
       return alertmsg(false, 'Please enter the keywords you select.');
}

function SetDiv(num)
{
   if(num == 1)
   {
      $Id("DivInfo").style.display = "block";
      $Id("DivHistory").style.display = "block";
      $Id("H4").style.display = "block";
      $Id("LI1").className = "on";
      $Id("LI2").className = "out";
      $Id("LI3").className = "out";
   }
   if(num == 2)
   {
      $Id("DivInfo").style.display = "block";
      $Id("DivHistory").style.display = "block";
      $Id("H4").style.display = "none";
      $Id("LI1").className = "out";
      $Id("LI2").className = "on";
      $Id("LI3").className = "out";
   }
   if(num == 3)
   {
      $Id("DivInfo").style.display = "none";
      $Id("H4").style.display = "block";
      $Id("DivHistory").style.display = "block";
      $Id("LI1").className = "out";
      $Id("LI2").className = "out";
      $Id("LI3").className = "on";
   }
}

function selectdiv(num)
{
	if(num == 1)
	{
		$Id("LI1").className = "on";
		$Id("LI2").className = "out";
		$Id("LI3").className = "out";
		$Id("LI4").className = "out";
		$Id("DIV1").style.display = "block";
		$Id("DIV2").style.display = "none";
		$Id("DIV3").style.display = "none";
		$Id("DIV4").style.display = "none";
	}
	if(num == 2)
	{
		$Id("LI1").className = "out";
		$Id("LI2").className = "on";
		$Id("LI3").className = "out";
		$Id("LI4").className = "out";
		$Id("DIV1").style.display = "none";
		$Id("DIV2").style.display = "block";
		$Id("DIV3").style.display = "none";
		$Id("DIV4").style.display = "none";
	}
	if(num == 3)
	{
		$Id("LI1").className = "out";
		$Id("LI2").className = "out";
		$Id("LI3").className = "on";
		$Id("LI4").className = "out";
		$Id("DIV1").style.display = "none";
		$Id("DIV2").style.display = "none";
		$Id("DIV3").style.display = "block";
		$Id("DIV4").style.display = "none";
	}
	if(num == 4)
	{
		$Id("LI1").className = "out";
		$Id("LI2").className = "out";
		$Id("LI3").className = "out";
		$Id("LI4").className = "on";
		$Id("DIV1").style.display = "none";
		$Id("DIV2").style.display = "none";
		$Id("DIV3").style.display = "none";
		$Id("DIV4").style.display = "block";
	}
}
////==========================================================================
////  关键字竞价 结束
////==========================================================================



//类别获取方法
function SearchSetClassListNews(moduleName, typeID) {
    var url = location.href;
    var urlid = "";
    if (url.indexOf("brand") != -1) {
        urlid = "brand";
    }
    if (url.indexOf("company") != -1) {
        urlid = "company";
    }
    var data = new SearchGetValue();
    var query = "&moduleName=" + moduleName + "&typeID=" + typeID + "&areaid=" ;
    query += "&times=&keyword=&flag=" + data.searchType.substring(0,data.searchType.length-2);    
        
    var ajaxcls = new Ajax("xy033",query);
    ajaxcls.onSuccess = function() {       
        if (ajaxcls.state.result == "1") {            
            if(ajaxcls.data) {
                var list = "";
                for(i=0;i<ajaxcls.data.classlist.length;i++) {
					//list += "<li><a href=\"javascript:pturl(" + ajaxcls.data.classlist[i].classID + ");\">"+ unescape(ajaxcls.data.classlist[i].className) +"(" + ajaxcls.data.classlist[i].infoNum + ")</a></li>";
                    list += "<li><a href='/search/seller_search-" + urlid + "-" + ajaxcls.data.classlist[i].classID + "--------.aspx'>" + unescape(ajaxcls.data.classlist[i].className) + "</a></li>";
                }
                $Id("ClassListNew").innerHTML = "" + list + "";
            }
            else {
                $Id("ClassListNew").innerHTML = "<li>No subclasses !</li>";
            }
        }
        else
            $Id("ClassListNew").innerHTML = "<li>No subclasses !</li>";
    }
}
function xy_GoToPage(pageIndex)
{
    if(pageIndex =="")return;
    
    if(isNaN(pageIndex))return;
    
    var total = parseInt($Id("totalPage").value);
    
    var toPage = parseInt(pageIndex);
    
    if(toPage <=0)return;

    if(toPage > total)
    {
        $Id("cpage").value=$Id("totalPage").value
    }
    
    listsearch();
}

function xy_setOrder(order){
    if(order!="grade" && order !="time" && order!="active")order ="";

    $Id("orderby").value = order;
    listsearch();
}


//2009-07-29

function ResumeListSearch() {
   
    if (isNaN(document.getElementById("Intentpay1").value)) {
        alertmsg(false, "Input illegal searching conditions!");
        return false;
    }
    if (isNaN(document.getElementById("Intentpay2").value)) {
        alertmsg(false, "Input illegal searching conditions!");
        return false;
    }
    if ($Fvalue("jobkeyword") != '') {
        if (!CheckSearchKey($Fvalue("jobkeyword"))) return false;
    }
    
    var data = new GetResumeSearchValue();

    var href = config.WebURL + "job/resumelist";
    if (config.BogusStatic) {
        
        for (var i = 0; i < data.query.length; i++) {
            href += "-";

            if (data.query[i] == "protypeid") {
                href += $Fvalue("protypeid");
            }
            else if (data.query[i] == "hopecityid") {
                href += $Fvalue("hopecityid");
            }
            else if (data.query[i] == "Schoolage")
                href += $Fvalue("Schoolage");
            else if (data.query[i] == "JobYear")
                href += ''; // $Fvalue("JobYear");
            else if (data.query[i] == "Intentpay1")
                href += $Fvalue("Intentpay1");
            else if (data.query[i] == "Intentpay2")
                href += $Fvalue("Intentpay2");
            else if (data.query[i] == "jobkeyword") {
            href += $Fvalue("jobkeyword");  // $Fvalue("schoolname");
            }
            else {
                href += data.value[i];
            }
        }
        href += "." + config.Suffix;
    }
    else {
        href += "." + config.Suffix;
        for (var i = 0; i < data.query.length; i++) {
            href += (0 == i ? "?" : "&") + data.query[i] + "=";

            if (data.query[i] == "protypeid") {
                href += $Fvalue("protypeid");
            }
            if (data.query[i] == "hopecityid") {
                href += $Fvalue("hopecityid");
            }
            else if (data.query[i] == "Schoolage")
                href += $Fvalue("Schoolage");
            else if (data.query[i] == "JobYear")
                href +='';//$Fvalue("JobYear");
            else if (data.query[i] == "Intentpay1")
                href += $Fvalue("Intentpay1");
            else if (data.query[i] == "Intentpay2")
                href += $Fvalue("Intentpay2");
            else if (data.query[i] == "jobkeyword") {
                href += $Fvalue("jobkeyword");  // $Fvalue("schoolname");
            }
            else
                href += data.value[i];
            
        }
    }
   
    window.location = href;
}

//获取简历搜索值
function GetResumeSearchValue() {

    var arrquery = new Array("protypeid", "hopecityid", "Schoolage", "JobYear", "Intentpay1", "Intentpay2", "jobkeyword", "pagesize", "pageindex", "custom");   
 
    var url = location.href;

    //从地址中取得需要的数据
    url = url.substr(url.lastIndexOf("/") + 1);

    var arrValue;

    if (config.BogusStatic) {
        var values = url.substring(0, url.lastIndexOf("." + config.Suffix));
        arrValue = values.split("-");
        arrValue.shift();
        arrValue[4] = unescape(arrValue[4]);
    }
    else {
        arrValue = new Array(arrquery.length);
        for (var i = 0; i < arrquery.length; i++) {
            arrValue[i] = GetQueryString(arrquery[i].replace(/^\s+|\s+$Id/g, ""));
        }
        arrValue[4] = unescape(arrValue[4]);
    }

    for (var i = 0; i < arrquery.length; i++) {
        if (arrValue[i] == undefined || arrValue[i] == "undefined") arrValue[i] = "";
    }

    return {
        query: arrquery,
        value: arrValue,
        objData: {
        protypeid: arrValue[0],
            hopecityid: arrValue[1],
            Schoolage: arrValue[2],
            JobYear: arrValue[3],
            Intentpay1: arrValue[4],
            Intentpay2: arrValue[5],
            schoolname: arrValue[6],
            pagesize: arrValue[7],
            pageindex: arrValue[8],
            custom: arrValue[9]
        }
    };
}
function SetResumeSearchDefaultValue() {
    var data = new GetResumeSearchValue();
    if (data.objData.protypeid.indexOf(",") != -1) {
        var arr = data.objData.protypeid.split(",");
        $Id("txtsearchkey").value = arr[0] == undefined ? "" : arr[0];
        $Id("protypeid").value = arr[1] == undefined ? "" : arr[1];
    }
    else {
        if (data.objData.protypeid != "undefined")
            $Id("protypeid").value = data.objData.protypeid;
    }
    try {
        $Id("hopecityid").value = data.objData.hopecityid;
        claArea1.Init();
    } catch (e) { }

    if ("" != data.objData.Schoolage) {
        $Id("Schoolage").value = data.objData.Schoolage;
    }
    if ("" != data.objData.JobYear) {
        $Id("JobYear").value = data.objData.JobYear;
    }
    if ("" != data.objData.Intentpay1) {
        $Id("Intentpay1").value = data.objData.Intentpay1;
    }
    if ("" != data.objData.Intentpay2) {
        $Id("Intentpay2").value = data.objData.Intentpay2;
    }
    if ("" != data.objData.schoolname) {
        $Id("schoolname").value = data.objData.schoolname;
    }
}

//去除空格
function isnonull() {
    $Id("protypeid").value = $Id("protypeid").value.replace(/^\s+|\s+$Id/g, "");
    $Id("schoolname").value = $Id("schoolname").value.replace(/^\s+|\s+$Id/g, "");
}




//网店相关

//设置当前要选中的菜单
function xy_Shop_SetMenu() {

    var tmpIndex = location.href.lastIndexOf("/");

    var pageName = location.href.substr(tmpIndex + 1, location.href.length - tmpIndex);

    pageName = pageName.split(".")[0];

    if (pageName == "") pageName = "index";

    if (pageName.indexOf("-") != -1) pageName = pageName.substr(0, pageName.indexOf("-"));

    if (pageName == "job") pageName = "joblist";

    if (pageName == "newsinfo") pageName = "newslist";

    if (pageName == "brandinfo") pageName = "brandlist";

    if (pageName == "machining" || pageName == "service" || pageName == "investment") pageName = "offer";

    var menuId = "";

    menuId = "_shop_menu_" + pageName;

    var pcon = document.getElementById("_shop_menu_list");

    var eles = pcon.getElementsByTagName("li");

    for (var i = 0; i < eles.length; i++) {
        if (eles[i].parentNode.id == '_shop_menu_list')
            eles[i].className = "";
    }
    if (!document.getElementById("hover"))
    document.getElementById(menuId).className = "hover";
}




//  网店内的搜索实现 开始
function xy_Shop_Search() {
    var productname = "";
    var productname = $Id("Products").value;
    var prourl = "";

    if (productname == "") return;

    prourl = "product--" + productname + "-." + config.Suffix;

    location = prourl;
}

//申请职位
function xy_Shop_ApplyJob() {
    var ajax = new Ajax("XY027", "&eid=" + $Fvalue("JobId"));
    ajax.onSuccess = function() {
        if (ajax.state.result == "1") {
            if (ajax.data.content == "nologin") {
                window.location.href = config.WebURL + 'login.' + config.Suffix + '?surl=' + escape(window.location.href);
                return false;
            }

            if (ajax.data.content == "ok") { alertmsg(false, "Resume sending success!"); return false; }
            if (ajax.data.content == "exists") { alertmsg(false, "Application failed! You have already applied for the position!"); return false; }
            if (ajax.data.content == "self") { alertmsg(false, "Application failed! This is your sent position!"); return false; }
            if (ajax.data.content == "company") { alertmsg(false, "You are an enterprise user, can not apply for position! "); return false; }
            if (ajax.data.content == "resume") { alertmsg(false, "Application failed! your resume hasn't been completed! "); return false; }
            //2010.03.04 begin
            if (ajax.data.content == "noauditing") { alertmsg(false, "Application failed! your resume hasn't been approved! please wait"); return false; }
            //2010.03.04 end
            alertmsg(false, "Sending failed! Please try again later!"); return false;
        }
    }
}

//推荐职位给好朋友
function xy_Shop_CommendJob() {
    var fromEmail = $Id("txtFromEmail").value;
    var toEmail = $Id("txtToEmail").value;
    var fromName = $Id("txtFromName").value;

    var msg = "", flag = true;
    var emails = toEmail.split(",")

    if (fromName == "") { msg = "Please enter your name."; flag = false; }
    if (fromEmail == "") {
        if (flag) { flag = false; msg = "Please enter your email."; }
        else { flag = false; msg += "<br/>Please enter your email."; }
    }
    else if (!ValidateEmail(fromEmail)) {
    if (flag) { flag = false; msg = "E-mail format is not correct."; }
    else { flag = false; msg += "<br/>E-mail format is not correct."; }
    }
    if (toEmail != "") {
        for (var i = 0; i < emails.length; i++) {
            if (!ValidateEmail(emails[i])) { flag = false; msg += "<br/>" + emails[i]; }
        }
        if (!flag) {
            msg += "<br/>E-mail format is not correct.";
        }
    }
    else {
        if (flag) { flag = false; msg = "Please enter your friend's email."; }
        else { flag = false; msg += "<br/>Please enter your friend's email."; }
    }

    if (!flag) { alertmsg(false, msg); return false; }

    var jobUrl = window.location.href;
    var jobName = $Id("txtjobname").value;

    sAlert("Sending, please wait...<br /><img src='/common/images/ajax-loader.gif' />");

    var ajax = new Ajax("XY028", "&FromEmail=" + fromEmail + "&ToEmail=" + toEmail + "&JobUrl=" + jobUrl + "&JobName=" + jobName + "&FromName=" + fromName);
    ajax.onSuccess = function() {
        if (ajax.state.result == "1") {
            sClose();
            if (ajax.data.content == "nologin") {
                window.location.href = config.WebURL + 'login.' + config.Suffix + '?surl=' + escape(window.location.href);
                return false;
            }

            if (ajax.data.content == "ok") { alertmsg(false, "Recommend Success.", window.location.href); return false; }
            if (ajax.data.content == "err") { alertmsg(false, "The system mail server configurations error, Failed! "); return false; }

            alertmsg(false, "sending failed! No mail server configurations!"); return false;
        }
    }
}

//清空推荐为好友表单
function xy_Shop_ResetCmdJobForm() {
    $Id("txtFromEmail").value = '';
    $Id("txtToEmail").value = '';
    $Id("txtFromName").value = '';
}

//
function xy_Sel_CurBigMenu(flagName) {
    var pBox = document.getElementById('_xy_big_menu_box');

    var aEles = pBox.getElementsByTagName("a");

    for (var i = 0; i < aEles.length; i++) {
        aEles[i].className = "";
    }

    if (flagName == undefined) {
        var curPage = location.href.replace(config.WebURL, "");

        curPage = curPage.substr(0, curPage.indexOf("/"));

        if (curPage == "") curPage = "index";

        var munuName = "_xymenu_" + curPage;

        try {
            document.getElementById(munuName).className = 'tabactive';
        } catch (e) {
            document.getElementById("_xymenu_index").className = 'tabactive';
        }
    }
    else {
        if (flagName == "") flagName = "index";

        var munuName = "_xymenu_" + flagName;

        try {
            document.getElementById(munuName).className = 'tabactive';
        } catch (e) {
            document.getElementById("_xymenu_index").className = 'tabactive';
        }
    }
}



function setTab(name, cursel, n) {
    var RefreshID = null;
    if (RefreshID) { clearTimeout(RefreshID); }
    RefreshID = setTimeout("Switch('" + name + "','" + cursel + "','" + n + "')", 10);
}

function Switch(name, cursel, n) {
    for (i = 1; i <= n; i++) {
        var menu = document.getElementById(name + i);
        var con = document.getElementById("con_" + name + "_" + i);
        menu.className = i == cursel ? "current" : "";
        con.style.display = i == cursel ? "block" : "none";
    }
}


function drop_mouseover(pos) {
    try { window.clearTimeout(timer); } catch (e) { }
}

function drop_mouseout(pos) {
    var posSel = document.getElementById(pos + "Sel").style.display;
    if (posSel == "block") {
        timer = setTimeout("drop_hide('" + pos + "')", 1000);
    }
}

function drop_hide(pos) {
    document.getElementById(pos + "Sel").style.display = "none";
}


window.onerror = function() { return true; }

function slideLine(ul, delay, speed, lh) {
    var slideBox = (typeof ul == 'string') ? document.getElementById(ul) : ul;
    var delay = delay || 1000, speed = speed || 20, lh = lh || 20;
    var tid = null, pause = false;
    var start = function() {
        tid = setInterval(slide, speed);
    }

    var slide = function() {
        if (pause) return;
        slideBox.scrollTop += 2;
        if (slideBox.scrollTop % lh == 0) {
            clearInterval(tid);
            slideBox.appendChild(slideBox.getElementsByTagName('li')[0]);
            slideBox.scrollTop = 0;
            setTimeout(start, delay);
        }
    }

    slideBox.onmouseover = function() { pause = true; }
    slideBox.onmouseout = function() { pause = false; }
    setTimeout(start, delay);

}


function pturls(ptid, shopusername) {
    
    var old = document.location.href;
    
    href = old.substring(0, old.lastIndexOf('/'));

    if (config.BogusStatic) {
        href += "/product-" + ptid + "--." + config.Suffix;
    }
    else {
        if (!config.IsDomain) {
            href = href.replace("/" + shopusername, "");
        }
        href += "/product." + config.Suffix + "?u_name=" + shopusername + "&typeid=" + ptid;
    }
    window.location.href = href;
}


function addFeedback() {
    
    var Parameters = ["title", "name", "telephone", "email", "comment", "authcode","type"];
    var title, name, telephone, email, comment, authcode;
    var che = true;
    $Id("titlemsg").innerHTML = $Id("namemsg").innerHTML = $Id("telephonemsg").innerHTML = $Id("emailmsg").innerHTML = $Id("commentmsg").innerHTML = $Id("authcodemsg").innerHTML = "";
    if ($Id("title").value == "") {
        $Id("titlemsg").innerHTML = "Subject is required";
        che = false;
    }    
    if ($Id("name").value == "") {
        $Id("namemsg").innerHTML = "Name is required";
        che = false;
    }
    if ($Id("telephone").value == "") {
        $Id("telephonemsg").innerHTML = "Tel is required";
        che = false;
    }
    else if (!ValidateMobileTel($Id("telephone").value) && !ValidateTel($Id("telephone").value))
     {
         $Id("telephonemsg").innerHTML = "telephone or cellphone format is not correct";
        che = false;
    }
    if ($Id("email").value == "") {
        $Id("emailmsg").innerHTML = "Email is required";
        che = false;
    }
    else if (!ValidateEmail($Id("email").value)) {
        $Id("emailmsg").innerHTML = "Email format is not correct";
        che = false;
    }
    if ($Id("comment").value == "") {
        $Id("commentmsg").innerHTML = "Comment is required";
        che = false;
    }
    if ($Id("authcode").value == "") {
        $Id("authcodemsg").innerHTML = "Identifying code is required";
        che = false;
    }
    if ($Id("type").value == "") {
        che = false;
    }
    
    if (!che) { return; }

    title = $Id("title").value;
    name = $Id("name").value;
     
    telephone = $Id("telephone").value;
    email = $Id("email").value;
    comment = $Id("comment").value;
    authcode = $Id("authcode").value;
    type1 = $Id("type").value;
    var parametersValue = [title, name, telephone, email, comment, authcode, type1];
    var query = ""; 
    for (var i = 0; i < Parameters.length; i++)
        query += "&" + Parameters[i] + "=" + parametersValue[i];

    var ajax = new Ajax("xy046", query); 
    ajax.onSuccess = function() {
    if (ajax.state.result == "1") {
        sAlert("OK,Submit Succeeded !", window.location.href);
        }
        else {
            sAlert("Sorry, Submit Failed !");
        }
    }
}


