﻿//
      function IsUsernameExist_callback(result)
      
         {  

          var btn=document.getElementById("ctl00_ContentPlaceHolder1_CreateUserWizard1___CustomNav0_StepNextButton");
              btn.disabled   =true;
             var msgok = document.getElementById('spusername');
   
             var value = result.value;

             if( value == '1' )
             {
                   msgok.style.color="#a5e360";
       msgok.innerHTML='<img src="Images/gou.gif" />该用户名未被使用，可以注册！';btn.disabled   =false;
                 return true;            
             }            
            if( value == '0' )
             {
                      msgok.style.color="#ed6d6d";
msgok.innerHTML='<img src="Images/cha.gif" />该用户名已经被使用，请重新填写！';btn.disabled   =true;
                 return false; 
             }
              if( value == '3' )
              {   msgok.style.color="#ed6d6d";
msgok.innerHTML='<img src="Images/cha.gif" />您输入的用户名不符合规范！';btn.disabled   =true;
              return false;}

         }
          function VerifyUserName(name)
         {
             register_aspx.GetReturnCode(name, IsUsernameExist_callback);
         }
        
       
          function IsEmailExist_callback(result)
         { var btn=document.getElementById("ctl00_ContentPlaceHolder1_CreateUserWizard1___CustomNav0_StepNextButton");
              btn.disabled   =true;
             var msgok = document.getElementById('spemail');
       
             var value = result.value;
             if( value == '1' )
             {
                 msgok.style.color="#a5e360";
 
                  msgok.innerHTML='<img src="Images/gou.gif" />该邮箱未被使用，可以使用!';
                  btn.disabled   =false;
                 return true;            
             }  
             if(value=="0")          
          
             {
                 msgok.style.color="#ed6d6d";
  msgok.innerHTML='<img src="Images/cha.gif" />该邮箱已经被使用，请重新填写！';btn.disabled   =true;
                 return false; 
             }
             if(value=="3")
             {
                msgok.style.color="#ed6d6d";
              msgok.innerHTML='<img src="Images/cha.gif" />您填写的邮箱不符合规范，请重新填写！';
              btn.disabled   =true;
             return false;}

         }
          function VerifyEmail(email)
         {
             register_aspx.GetEmailReturnCode(email, IsEmailExist_callback);
         }
        

//控制所有职位的详细显示和列表显示
function modsome(listtype)
{

if(listtype==0)
{

//var MXtd=document.getElementById("tdMX");
//var MXspan=document.getElementById("spanMX");
//var para01=document.createElement("a");
//var txtMX=document.createTextNode("明细");
//para01.setAttribute("onclick","modsome('1')");
//para01.setAttribute("href","viewalljobs.aspx");
//para01.id="aMX";
//para01.appendChild(txtMX);
//MXtd.replaceChild(para01,MXspan);

//var LBtd=document.getElementById("tdLB");
//var LBa=document.getElementById("aLB");
//var para02=document.createElement("span");
//var txtLB=document.createTextNode("列表");
//para02.id="spanLB";
//para02.appendChild(txtLB);
//LBtd.replaceChild(para02,LBa);

document.getElementById("divMX").style.display="none";
document.getElementById("divLB").style.display="";

return;
}
else
{

//var MXtd02=document.getElementById("tdMX");
//var MXa02=document.getElementById("aMX");
//var para03=document.createElement("span");
//var txtMX02=document.createTextNode("明细");
//para03.setAttribute("id","spanMX");

//para03.appendChild(txtMX02);
//MXtd02.replaceChild(para03,MXa02);

//var LBtd02=document.getElementById("tdLB");
//var LBspan02=document.getElementById("spanLB");
//var para04=document.createElement("a");
//var txtLB02=document.createTextNode("列表");
//para04.setAttribute("id","aLB");
//para04.setAttribute("href","#");
//para04.setAttribute("onclick","modsome('0')");
//para04.appendChild(txtLB02);
//LBtd02.replaceChild(para04,LBspan02);


document.getElementById("divMX").style.display="";
document.getElementById("divLB").style.display="none";

return;
}

}
//

$(document).ready(function(){
	//LOADING POPUP
	//Click the button event!
	$("#GridView1_ctl03_btnView").click(function(){alert("dfdf");
		openmsgDiv()
	});

});


//打开messagediv
function openmsgDiv()
{ 
  var msgdiv=document.getElementById("msgDetails");
  msgdiv.style.display="";
}

//返回上一页
function back()
{
history.back();
}

//职位应聘处div的显示控制
function divControl()
{
 var div1=document.getElementById("divA");
 var div2=document.getElementById("divB");
 div1.style.display="none";  
 div2.style.display="";


}

//重置搜索条件
function reSetSearch()
{
var select1=document.getElementById("ctl00_ContentPlaceHolder1_txtHYLB");
var select2=document.getElementById("ctl00_ContentPlaceHolder1_txtGZDD");
    
 for(var i=0;i<select1.options.length;i++)
      {
          for(var j=select1.options.length-1;j>-1;j--)
          {
               select1.options.remove(j);  

               }
             


        } 
 for(var i=0;i<select2.options.length;i++)
     { 
         for(var j=select2.options.length-1;j>-1;j--)
          {
          
               select2.options.remove(j);  
               }
        

        } 
  document.getElementById("ctl00_ContentPlaceHolder1_txtbxGJZ").value="";
  document.getElementById("ctl00_ContentPlaceHolder1_ddlFBSJ").options[0].selected = true;
}

//弹出的div窗口控制
function centerPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupContact").height();
	var popupWidth = $("#popupContact").width();
	//centering
	$("#popupContact").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
}

var browser = {};
var ua = navigator.userAgent.toLowerCase();
var s;
(s = ua.match(/msie ([\d.]+)/)) ? browser.ie = s[1] :
(s = ua.match(/firefox\/([\d.]+)/)) ? browser.firefox = s[1] :
(s = ua.match(/chrome\/([\d.]+)/)) ? browser.chrome = s[1] :
(s = ua.match(/opera.([\d.]+)/)) ? browser.opera = s[1] :
(s = ua.match(/version\/([\d.]+).*safari/)) ? browser.safari = s[1] : 0;
var w3c = (document.getElementById) ? true : false;
var ns6 = (w3c && (navigator.appName == "Netscape")) ? true : false;
//遮盖屏幕
//Page size
function getPageWidth(){
	// handle IE 6
	if ($.browser.msie && $.browser.version < 7) {
		var scrollWidth = Math.max(
			document.documentElement.scrollWidth,
			document.body.scrollWidth
		);
		var offsetWidth = Math.max(
			document.documentElement.offsetWidth,
			document.body.offsetWidth
		);

		if (scrollWidth < offsetWidth) {
			return $(window).width();
		} else {
			return scrollWidth;
		}
	// handle "good" browsers
	} else {
		return $(document).width();
	}
}
function getPageHeight(){
	// handle IE 6
	if ($.browser.msie && $.browser.version < 7) {
		var scrollHeight = Math.max(
			document.documentElement.scrollHeight,
			document.body.scrollHeight
		);
		var offsetHeight = Math.max(
			document.documentElement.offsetHeight,
			document.body.offsetHeight
		);

		if (scrollHeight < offsetHeight) {
			return $(window).height();
		} else {
			return scrollHeight;
		}
	// handle "good" browsers
	} else {
		return $(document).height();
	}
}
//Cover code 
//filterNumber为透明度0-1之间
function popCover(fiterNumber) {
	if (document.getElementById("coverDiv")) {
		//cover div exist
		$("#coverDiv").show();
	} else {
		//cover div noe exist
		var page_height = getPageHeight() + "px";
		var page_width = getPageWidth() + "px";
		var coverDiv = document.createElement('div');
		document.body.appendChild(coverDiv);
		coverDiv.id = "coverDiv";
		var ieFilter = fiterNumber * 100;
		with (coverDiv.style) {
			position = 'absolute';
			background = '#CCCCCC';
			left = '0px';
			top = '0px';
			width = page_width;
			height = page_height;
			zIndex = 5;
			if (browser.ie) {
				filter = "Alpha(Opacity=" + ieFilter + ")";
			} else {
				opacity = fiterNumber;
			}
		}
	}
}
//Open 提示窗口
 function openWindow(){
	//Set position and style
	//page size
	var textbox=document.getElementById("ctl00_ContentPlaceHolder1_t_sendText");
	if(textbox.value=="")
	{ alert("请输入申请留言！");return;}

	var page_height = getPageHeight();
	var page_width = getPageWidth();
	//window size
	var divWidth= $("#selectWindow").outerWidth();
	var divHeight=$("#selectWindow").outerHeight();
    //div position
	var divTop=(page_height-divHeight)/2 + "px";
	var divLeft=(page_width-divWidth)/2 + "px";
	
	with (document.getElementById("selectWindow").style) {
			position = 'absolute';
			background = '#fff';
			left = divLeft;
			top = divTop;
			zIndex = 10;//lager than popcover div
		}

	$("#selectWindow").show("normal");
	popCover(0.5);
}
//Open Select Window
function openWindow(){
	//Set position and style
	//page size
	var textbox=document.getElementById("ctl00_ContentPlaceHolder1_t_sendText");
	if(textbox.value=="")
	{ alert("请输入申请留言！");return;}

	var page_height = getPageHeight();
	var page_width = getPageWidth();
	//window size
	var divWidth= $("#selectWindow").outerWidth();
	var divHeight=$("#selectWindow").outerHeight();
    //div position
	var divTop=(page_height-divHeight)/2 + "px";
	var divLeft=(page_width-divWidth)/2 + "px";
	
	with (document.getElementById("selectWindow").style) {
			position = 'absolute';
			background = '#fff';
			left = divLeft;
			top = divTop;
			zIndex = 10;//lager than popcover div
		}

	$("#selectWindow").show("normal");
	popCover(0.5);
}
function closeWindow(){

	$("#selectWindow").hide("normal");
	$("#coverDiv").hide();

	var SYtd=document.getElementById("tdSY");
var SYspan=document.getElementById("spanSY");
var para01=document.createElement("a");
var txtSY=document.createTextNode("所有职位");
para01.setAttribute("onclick","modSYZW()");
para01.setAttribute("href","viewalljobs.aspx");
para01.id="aSY";
para01.appendChild(txtSY);
SYtd.replaceChild(para01,SYspan);


}

function openSearchWindow(){
	
var str=document.getElementById("ctl00_ContentPlaceHolder1_txtbxGJZ").value;
var arry=str.split('+');
document.getElementById("ctl00_ContentPlaceHolder1_txtbxGJZ").value=arry[0];
		
centerPopup();
	$("#popupContact").show("normal");
	popCover(0.5);
	
}
function closeSearchWindow(){
	$("#popupContact").hide("fast");
	$("#coverDiv").hide();
}

function openSQdiv()
{
document.getElementById("shenqing").style.display="";

}

function showmorediv(i)
{
if(i==1)
{

document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_JYJL02").style.display="";
return;
}
if(i==2)

{document.getElementById("ctl00_ContentPlaceHolder1_Wizard1_GZJL02").style.display="";
return;
}
}

function selectall()
{  
    var   chks   =   document.getElementsByTagName("INPUT");      
    for(var   i=0;i<chks.length;i++)   
    {             
          if(chks[i].type =="checkbox")   
          { 
  
             chks[i].checked=true;         
          }   
    }  
 }
   
function selectnone()
{
    var   chks   =   document.getElementsByTagName("INPUT");      
    for(var   i=0;i<chks.length;i++)   
    {             
          if(chks[i].type =="checkbox")   
          { 
  
             chks[i].checked=false;         
          }   
    }  
}
    
function selectchange()
{
   var   chks   =   document.getElementsByTagName("INPUT");   
    for(var   i=0;i<chks.length;i++)   
    {   
   
           
          if(chks[i].type =="checkbox")   
          {    
                 if(chks[i].checked)
                  {
                  
                  chks[i].checked=false;

                  }  
                  
                 else
                  { chks[i].checked=true;

                  }
                 
                
          }     
    }  
}

//purchase hide

document.write("<style>.purchase #left table th p { display:none;} .defaultSalesman { display:none;}</style>");

//弹出对话框
function ale()
{
alert("成功添加到收藏夹");
}

//刷新验证码
  function refreshing() 
    { 
    document.getElementById("getcode").src="image.aspx"; 
    } 

//load func

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

//control foot top

/*function getheight() {
   if(!document.getElementById("right"))
    {   
        var left = document.getElementById("left");
	    var foot = document.getElementById("foot");
	    var leftheight = left.clientHeight;

		    foot.style.top = leftheight + 157 + "px";

	    if (parseInt(foot.style.top) + 90 < document.documentElement.offsetHeight) {
		    foot.style.top = document.documentElement.offsetHeight - 90 + "px";
	    }
	    if (parseInt(foot.style.top) + 90 < window.innerHeight) {
		    foot.style.top = window.innerHeight - 90 + "px";
	    }
	    return;
	 }
    else
    {
	    if(!document.getElementById("left")) return false;
	    var left = document.getElementById("left");
	    var right = document.getElementById("right");
	    var foot = document.getElementById("foot");
	    var leftheight = left.clientHeight;
	    var rightheight = right.clientHeight;
	    if ( leftheight > rightheight) {
		    foot.style.top = leftheight + 157 + "px";
	    }
	    else {
		    foot.style.top = rightheight + 157 + "px";
	    }
	    if (parseInt(foot.style.top) + 90 < document.documentElement.offsetHeight) {
		    foot.style.top = document.documentElement.offsetHeight - 90 + "px";
	    }
	    if (parseInt(foot.style.top) + 90 < window.innerHeight) {
		    foot.style.top = window.innerHeight - 90 + "px";
	    }
	}
		alert(foot.style.top);
}

addLoadEvent(getheight);*/

//purchase pages,show text in table

function showhide() {
	var hidetext = this.nextSibling;
	if(hidetext.nodeType == 3) {
		hidetext = hidetext.nextSibling;
	}
    hidetext.className = (hidetext.className == "") ? "show":"";
	getheight();
}

function purchase_show() {
	if(!document.getElementById("show_table")) return false;
	var show_table = document.getElementById("show_table");
	var strongs = show_table.getElementsByTagName("strong");
	for(var j=0; j<strongs.length; j++) {
		if(strongs[j].className == "showhide") {
			strongs[j].onclick = showhide;
		}
	}
}

addLoadEvent(purchase_show);
	
	
//all menu effects

//this func only for some cate which have return menu
function rightmenuHover(menuobj) {
	var links = menuobj.getElementsByTagName("a");
	var windowLocationhref = window.location.href.split("/");
	var locationHref;
	if(windowLocationhref[windowLocationhref.length-1] == "") {
		locationHref = windowLocationhref[windowLocationhref.length-2];
	} else {
		locationHref = windowLocationhref[windowLocationhref.length-1];
	}
	for(i=0; i<links.length; i++) {
		var linksHref = links[i].href.split("/");
		var linksRighthref;
		if(linksHref[linksHref.length-1] == "") {
			linksRighthref = linksHref[linksHref.length-2];
		} else {
			linksRighthref = linksHref[linksHref.length-1];
		}
		if(locationHref == linksRighthref) {
			links[i].className = 'here';
		} else {
			links[i].className = '';
		}
		links[i].onmouseover = function() {
			for(j=0; j<links.length; j++) {
				links[j].className = '';
			}
			this.className = 'here';
		}
		links[i].onmouseout = function() {
			for(j=0; j<links.length; j++) {
				links[j].className = '';
				var linksHref2 = links[j].href.split("/");
				var linksRighthref2;
				if(linksHref2[linksHref2.length-1] == "") {
					linksRighthref2 = linksHref2[linksHref2.length-2];
				} else {
					linksRighthref2 = linksHref2[linksHref2.length-1];
				}
				if(locationHref == linksRighthref2) {
					links[j].className = 'here';
				}
			}
	}
	}
}

//for common menu
function topmenuHover(menuobj) {
	var links = menuobj.getElementsByTagName("a");
	for(i=0; i<links.length; i++) {
		if(window.location.href.indexOf(links[i].href) != -1) {
			links[i].className = 'here';
		} else {
			links[i].className = '';
		}
		links[i].onmouseover = function() {
			for(j=0; j<links.length; j++) {
				links[j].className = '';
			}
			this.className = 'here';
		}
		links[i].onmouseout = function() {
			for(j=0; j<links.length; j++) {
				links[j].className = '';
				if(window.location.href.indexOf(links[j].href) != -1) {
					links[j].className = 'here';
				}
			}
	}
	}
}

//top menu effect
function topmenu () {
	if(!document.getElementById("menu")) return false;
	var menuobj = document.getElementById("menu");
	topmenuHover(menuobj);
}

//right menu effect
function rightmenu () {
	if(!document.getElementById("right")) return false;
	var menuobj = document.getElementById("right");
	rightmenuHover(menuobj);
}

addLoadEvent(topmenu);
addLoadEvent(rightmenu);

//products pages,tab

function prepareshow() {
	if(!document.getElementById("description_head")) return false;
	var description_head = document.getElementById("description_head");
	var description_links = description_head.getElementsByTagName("a");
	for(var i=0; i<description_links.length; i++) {
		var sectionId = description_links[i].getAttribute("href").split("#")[1];
		description_links[i].ment = sectionId;
		description_links[i].onclick = function() {
			showtab(this.ment);
			getheight();
			for(var j=0; j<description_links.length; j++) {
				description_links[j].className = '';
			}
			this.className = 'here';
			return false;
		}
		description_links[i].onmouseover = function() {
			for(var j=0; j<description_links.length; j++) {
				description_links[j].className = '';
			}
			this.className = 'here';
		}
		description_links[i].onmouseout = function() {
			for(var j=0; j<description_links.length; j++) {
				description_links[j].className = '';
			}
			var description_content = document.getElementById("description_content");
			var divs = description_content.getElementsByTagName("div");
			for( var d=0; d<divs.length; d++) {
				if(divs[d].style.display == "block") {
					var theid = divs[d].getAttribute("id");
					for(var k=0; k<description_links.length; k++) {
						description_links[k].className = "";
						if(description_links[k].href.indexOf(theid) != -1) description_links[k].className = 'here';
					}
				}
			}
		}
			
	}
}

function showtab(id) {
	var description_content = document.getElementById("description_content");
	var divs = description_content.getElementsByTagName("div");
	for( var i=0; i<divs.length; i++) {
		divs[i].style.display = "none";
		if (divs[i].getAttribute("id") != id) {			
			divs[i].style.display = "none";
		} 
		else {
			divs[i].style.display = "block";
		}
	}
}

function showfirst() {
	if(!document.getElementById("description_content")) return false;
	var description_content = document.getElementById("description_content"); 
	if(!document.getElementById("description_head")) return false;
	var description_head = document.getElementById("description_head");
	var description_links = description_head.getElementsByTagName("a");
	for(var i=0; i<description_links.length; i++) {
		var sectionId = description_links[i].getAttribute("href").split("#")[1];
		description_links[i].ment = sectionId;
		var now_href = window.location.href;
		if(now_href.indexOf(sectionId) != -1) {
			divs[0].style.display = 'none';
			document.getElementById(sectionId).style.display = 'block';
		} else {
			var divs = description_content.getElementsByTagName("div");
			divs[0].style.display = 'block';
		}
		if(now_href.indexOf(description_links[i].getAttribute("href")) != -1) {
			for(var j=0; j<description_links.length; j++) {
				description_links[j].className = '';
			}
			description_links[i].className = "here";
		}
	}
	getheight();
}

addLoadEvent(showfirst);
addLoadEvent(prepareshow);

//product-ecshop,the last two tab

function ec_special_tag() {
	if(!document.getElementById("product_top")) return false;
	var product_top = document.getElementById("product_top");
	if(!document.getElementById("description_head")) return false;
	var description_head = document.getElementById("description_head");
	var description_head_ul = description_head.getElementsByTagName("ul");
	if(product_top.className == "ec_bg") {
		var ec_lastli2 = document.createElement("li");
		description_head_ul[0].appendChild(ec_lastli2);
		var ec_lasta2 = document.createElement("a");
		ec_lasta2.href = "http://tiyan.ecshop.com";
		ec_lasta2.target = "_blank";
		ec_lastli2.appendChild(ec_lasta2);
		var ec_lasttext2 = document.createTextNode("免费体验");
		ec_lasta2.appendChild(ec_lasttext2);
		var ec_lastli1 = document.createElement("li");
		description_head_ul[0].appendChild(ec_lastli1);
		var ec_lasta1 = document.createElement("a");
		ec_lasta1.href = "http://ecshop.com/garniture_plan/";
		ec_lasta1.target = "_blank";
		ec_lastli1.appendChild(ec_lasta1);
		var ec_lasttext1 = document.createTextNode("行业解决方案");
		ec_lasta1.appendChild(ec_lasttext1);
		description_head.getElementsByTagName("ul")[0].style.liststyletype = "none";
	}
}

addLoadEvent(ec_special_tag);

//products pages,right ad adds

function add_banner(pages,b_page,b_html) {
	if(!document.getElementById("content")) return false;
	var content = document.getElementById("content");
	if(!document.getElementById("right")) return false;
	var right = document.getElementById("right");
	if(pages.className == b_page) {
		var banner_div = document.createElement("div");
		banner_div.setAttribute("id","small_banner");
		banner_div.style.top = right.clientHeight - 135 + "px";
		banner_div.innerHTML = b_html ;
		content.appendChild(banner_div);
		right.className = "small_banner_ul";
		var uls = right.getElementsByTagName("ul");
		uls[0].style.paddingBottom = banner_div.clientHeight -20 +"px";
		getheight();
	}
}


function product_banner() {
	if(!document.getElementById("product_top")) return false;
	var pages = document.getElementById("product_top");
	var b_page= "agg_bg";
	var b_html = '<a href="http://idc.comsenz.com"><img src="/templates/default/images/otherlink/xnzj.gif" /></a>';
	add_banner(pages,b_page,b_html);
}
addLoadEvent(product_banner);

function down_banner() {
	if(!document.getElementById("content")) return false;
	var pages = document.getElementById("content");
	var b_page= "down";
	//var b_html = '<embed src="/templates/default/images/otherlink/idc.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="171" height="331" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	var b_html = '<a href="http://www.discuz.net/thread-1183937-1-1.html"><img src="/templates/default/images/otherlink/ad04.jpg" width="171" height="331" align="middle" /></a>';
	add_banner(pages,b_page,b_html);
}
addLoadEvent(down_banner);


//purchases pages,control some long e-mail

function address_cut() {
	if(!document.getElementById("contact")) return false;
	var contact = document.getElementById("contact");
	var lis = contact.getElementsByTagName("li");
	for(var i=0; i<lis.length; i++) {
		if(lis[i].className == "c_msn") {
			var strContent=lis[i].innerHTML;  
			var strTemp="";
			while(strContent.length>23){
				strTemp+=strContent.substr(0,18)+"<br />";
				strContent=strContent.substr(18,strContent.length); 
				strTemp+=strContent;
				lis[i].innerHTML=strTemp;
			}
		}
	}
}

addLoadEvent(address_cut);

//download openpop

function createXMLHttpRequest() {
	if(window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHttp");
	} else if(window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
}

function downOpen() {
	if(document.getElementById("down_open")) {
		var down_open = document.getElementById("down_open");
		var links = down_open.getElementsByTagName("a");
		for(var i=0; i<links.length; i++) {
			if(links[i].rel) {
				links[i].rel = links[i].href;
				links[i].href = "#";
				links[i].onclick = createDownBlock;
			}
		}
	}
}

addLoadEvent(downOpen);



