﻿

function externallinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "main";
 if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external2") 
     anchor.target = "_blank"; 
 } 
} 
window.onload = externallinks;



function dis(sid)
				{
					var num=3;
					if(document.all(sid).style.display == "none")
					{
					  document.all(sid).style.display="block";
					  for(i=1;i<=num;i++)
					  {
											  }
					}
					else
					{
					  document.all(sid).style.display="none";
					}
				}
				
				
				
//È«Ñ¡¸´Ñ¡¿ò
function CheckAll(form){
	for (var i=0;i<form.elements.length;i++){
	var e = form.elements[i];
	if (e.name != 'chkall' && e.type=="checkbox")e.checked = form.chkall.checked;
	}
}
			
				
				
				
function Showlist(index,Max){
	for(var i=1;i<=Max;i++){
		document.getElementById("Listcentent"+i).style.display="none";
		document.getElementById("ListHeader"+i).className="icos IcoOpen";
	}
	document.getElementById("ListHeader"+index).className="icos IcoOpen";
	document.getElementById("Listcentent"+index).style.display="";
}
			
			
				
				
var UserAgent = navigator.userAgent.toLowerCase();
var ie4=document.all&&UserAgent.indexOf("opera")==-1
var ns6=document.getElementById&&!document.all
				
				
//Ajax Start
function Ajax_GetXMLHttpRequest() {
	if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} 
	else if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	}
}


	function fEvent(sType,oInput){
		switch (sType){
			case "focus" :
				oInput.isfocus = true;
				oInput.style.backgroundColor='#FFFFD8';
			case "mouseover" :
				//oInput.style.borderColor = '#99E300';
				break;
			case "blur" :
				oInput.isfocus = false;
				oInput.style.backgroundColor="#fff";
			case "mouseout" :
				if(!oInput.isfocus){
					//oInput.style.borderColor='#A1BCA3';
				}
				break;
		}
	}

			
function Ajax_CallBack(FormName,ID,URL,IsAlert){
//document.write (URL);
//alert (URL);
	var x = Ajax_GetXMLHttpRequest();
	var ID = $(ID);
	x.open("POST",URL);
	x.setRequestHeader("REFERER", location.href);
	x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	x.onreadystatechange = function(){if(x.readyState == 4 && x.status == 200){if(IsAlert){x.responseText?alert(x.responseText):alert('添加成功');}else if(ID){ID.innerHTML=x.responseText;}}}
	var encodedData=""
	if (document.forms.length > 0 && FormName) {
		var form = document.forms[FormName];
		for (var i = 0; i < form.length; ++i) {
			var element = form.elements[i];
			if (element.name) {
				var elementValue = null;
				if (element.nodeName == "INPUT") {
					var inputType = element.getAttribute("TYPE").toUpperCase();
					if (inputType == "TEXT" || inputType == "PASSWORD" || inputType == "HIDDEN") {
						elementValue = escape(element.value);
					} else if (inputType == "CHECKBOX" || inputType == "RADIO") {
						if (element.checked) {
							elementValue = escape(element.value);
						}
					}
				} else if (element.nodeName == "SELECT" || element.nodeName == "TEXTAREA") {
					elementValue = escape(element.value);
				}
				if (elementValue) {
					if(encodedData==""){
						encodedData = element.name + "=" + encodeURIComponent(elementValue);
					}
					else{
						encodedData += "&" + element.name + "=" + encodeURIComponent(elementValue);
					}
				}
			}
		}

	}
	x.send(encodedData);

}

//Ajax End
				
				
				
function ShowPannel(btn){
	var idname = new String(btn.id);
	var s = idname.indexOf("_");
	var e = idname.lastIndexOf("_")+1;
	var tabName = idname.substr(0, s);
	var id = parseInt(idname.substr(e, 1));
	var tabNumber = btn.parentNode.childNodes.length;
	for(i=0;i<tabNumber;i++){
		document.getElementById(tabName+"_tab_"+i).style.display = "none";
		document.getElementById(tabName+"_btn_"+i).className = "h2bg";
	};
	document.getElementById(tabName+"_tab_"+id).style.display = "block";
	btn.className = "";
}


				
				


//跳转页面显示
function ShowPage(TotalPage,PageIndex,RecordCount,PageSetup,url){
	document.write("<form onsubmit=\"return false;\"><table style='clear: both;float:right'><tr><td valign='baseline' class='PageInation'><a class=MultiPagestext>共"+PageIndex+"页当前显示第"+TotalPage+"页,共"+RecordCount+"条记录，每页显示"+PageSetup+"条</a>");
	if (PageIndex<6) {
		PageLong=11-PageIndex;
	}
	else
		if (TotalPage-PageIndex<6) {
			PageLong=10-(TotalPage-PageIndex)
		}
		else {
			PageLong=5;
		}
	for (var i=1; i <= TotalPage; i++) {
		if (i < PageIndex+PageLong && i > PageIndex-PageLong || i==1 || i==TotalPage){
			if (PageIndex==i) {
				document.write("<a class=CurrentPage>"+ i +"</a>");
			}
			else {
				document.write("<a class=PageNum href=?PageIndex="+i+"&"+url+">"+ i +"</a>");
			}
		}
	}
	document.write("<input onkeydown=if((event.keyCode==13)&&(this.value!=''))window.location='?PageIndex='+this.value+'&"+url+"'; onkeyup=if(isNaN(this.value))this.value='' class=PageInput></td></tr></table></form>");
}













/*
**Ajax 增加评论*/
function IsObjAddComment(OjbSpanID,id_type) {
 var temp=document.getElementsByName("rank");
 for (i=0;i<temp.length;i++){if(temp[i].checked){var rank=temp[i].value; }}
var email=document.getElementById('email').value;
 function   String.prototype.isEmail(){
  return   new   RegExp(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).test(this);
 }   
 if   (email.isEmail()==false){
  alert("请输入有效的email地址！");
  return false;
 }
var id_value=document.getElementById('id_value').value;
var content=document.getElementById('content').value;
if (content==""){alert("请输入评论内容！");return false;}
var captcha=document.getElementById('captcha').value;
if(captcha==""){alert("请输入验证码！");return false;}
var chkcodeinput=document.getElementById('chkcodeinput').value;
if(chkcodeinput=="0"){alert("验证码错误请重新输入！");return false;}
alert("您的评论已经发表！感谢您的参与！");
id_type== "" ? $(OjbSpanID).innerHTML = "正在刷新评论列表！" : Ajax_CallBack(false,OjbSpanID,'Loading.asp?menu=AddComment&id_type='+id_type+'&rank='+rank+'&email='+escape(email)+'&id_value='+escape(id_value)+'&content='+escape(content));
document.getElementById('CommentSubmit').style.display = "None";
document.getElementById('CommentSubmitText').innerHTML = "<span class='red' style='float:right'>您的评论已经发表！感谢您的参与！</span>";
document.getElementById('content').value="";
document.getElementById('email').value="";
document.getElementById('captcha').value="";
}




/**
***购物车**/
//AddCat("cookie名称","产品ID","产品名称","产品数量",价格)
function AddCat(name, ID, pro, num, pri,img)
{
  var test=false;
  var values="," + escape(ID) + "#" + escape(pro) + "#" + escape(num) + "#" + escape(pri) + "#" + escape(img);
  var cookieValue = readCookie(name);
		sss=cookieValue.split(",")
		for (i=0;i<sss.length;i++){
		s=sss[i].split("#");
			for(j=0;j<s.length;j++){
				if(s[0]==ID)
				{
					cookieValue=cookieValue.replace(","+sss[i],"");
					nums=s[2];
					test=true;
		new xWin('a50001','icoIfo','Message：','You have purchased the goods, will only add in the number of！','To enter the settlement center','location.href=\"ShowCat.asp?cmd=consignee\"','Determine')
					break;
			}

			// location.href = 'ShowCat.asp';
			}
		}
	if (test)
	{
		document.cookie = name + "=" + cookieValue+ "," + escape(ID) + "#" + escape(pro) + "#" + escape(parseInt(num)+parseInt(nums)) + "#" + escape(pri) + "#" + escape(img);
		test=false;
	}
	else
	{
		document.cookie = name + "=" + cookieValue+values;
		new xWin('a50002','icoIfo','Message：','Product has been added to your shopping cart！','To enter the settlement center','location.href=\"ShowCat.asp?cmd=consignee\"','Determine')
	}
				Ajax_CallBack(false,'ajaxshowcat','Loading.asp?menu=AjaxShowcat');	

}



function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = document.cookie.substring(offset, end)
    }
  }
  return cookieValue;
}












function externallinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank";
 if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external2") 
     anchor.target = "_blank"; 
 } 
} 
window.onload = externallinks;






// 
function ContentSize(size)
{
var obj=document.getElementById("size");obj.style.fontSize=size+"px";
}
// 
function copyText(obj) 
{
var rng = document.body.createTextRange();rng.moveToElementText(obj);rng.scrollIntoView();rng.select();rng.execCommand("Copy");rng.collapse(false);
}











var old='';
var old_subject='';
var old_icon='';
function ripp(name)
{
	ripple=eval("ripple_"+name+".style");
	subject=eval("subject_"+name+".style");
	icon=eval("faqico_"+name);
	
	
	if(old!=ripple)
	{
		if(old!='')
		{
			old.display='none';
			old_subject.color='#666666';
			old_subject.fontWeight='normal';
			old_icon.src='img/go_on.gif';
		}
		ripple.display='block';
		subject.color='#5A8AA7';
		subject.fontWeight='bold';
		icon.src='img/go_off.gif';
		old=ripple;
		old_subject=subject;
		old_icon=icon;
	}
	else
	{
		ripple.display='none';
		subject.color='#666666';
		subject.fontWeight='normal';
		icon.src='img/go_on.gif';
		old='';
	}
}










function dis(sid)
				{
					var num=3;
					if(document.all(sid).style.display == "none")
					{
					  document.all(sid).style.display="block";
					  for(i=1;i<=num;i++)
					  {
											  }
					}
					else
					{
					  document.all(sid).style.display="none";
					}
				}



function getURL(url){
	if(url.indexOf("http://") == 0){window.open(url);}
	else{window.location = url;}
}





/*------------------------- 底部菜单  ---------------------*/
function end_01(){location.href="/";}
function end_02(){location.href="Display.asp?cmd=about&classcode=105&keyno=859";}
function end_03(){location.href="Job.asp?cmd=about&classcode=105";}
function end_04(){location.href="Display.asp?cmd=hkcopy&classcode=556&keyno=739";}
function end_05(){location.href="Display.asp?cmd=bvicopy&classcode=557&keyno=770";}
function end_06(){location.href="Display.asp?cmd=encopy&classcode=559&keyno=777";}



function ShowHJSearch(index,Max){
	for(var i=0;i<=Max;i++){
		document.getElementById("content"+i).style.display="none";
		document.getElementById("HJSearchHeader"+i).className="HJSearch_off";
	}
	document.getElementById("HJSearchHeader"+index).className="HJSearch_on";
	document.getElementById("content"+index).style.display="";
}

function OpenWindow(){

document.getElementById('navmask').style.visibility='visible';
document.getElementById('navmask').style.opacity = '0.7';
document.getElementById('navmask').style.filter = 'Alpha(opacity=70)';
document.documentElement.style.overflow = 'hidden';
document.getElementById('navmask').style.height = document.documentElement.scrollHeight;
document.getElementById('navmask').style.width = document.documentElement.scrollWidth;
document.getElementById('massage_box').style.visibility='visible';
}


function CloseWindow(){
document.getElementById('navmask').style.visibility='hidden';
document.getElementById('massage_box').style.visibility='hidden';
document.documentElement.style.overflow = 'auto';
}






Ext.onReady(function(){
	
	if(!Ext.getDom('hd')){
		return;
	}
	
	var activeMenu;
	
	function createMenu(name){
		var el = Ext.get(name+'-link');
		var tid = 0, menu, doc = Ext.getDoc();
		
		var handleOver = function(e, t){
			if(t != el.dom && t != menu.dom && !e.within(el) && !e.within(menu)){
				hideMenu();
			}	
		};
				
		var hideMenu = function(){
			if(menu){
				menu.hide();
				el.setStyle('text-decoration', '');
				doc.un('mouseover', handleOver);
				doc.un('mousedown', handleDown);
			}
		}
		
		var handleDown = function(e){
			if(!e.within(menu)){
				hideMenu();
			}
		}
		
		var showMenu = function(){
			clearTimeout(tid);
			tid = 0;
			
			if (!menu) {
				menu = new Ext.Layer({shadow:'sides',hideMode: 'display'}, name+'-menu');
			}
			menu.hideMenu = hideMenu;
				
			menu.el = el;
			if(activeMenu && menu != activeMenu){
				activeMenu.hideMenu();
			}
			activeMenu = menu;
			
			if (!menu.isVisible()) {
				menu.show();
				menu.alignTo(el, 'tl-bl?');
				menu.sync();
				el.setStyle('text-decoration', 'underline');
				
				doc.on('mouseover', handleOver, null, {buffer:150});
				doc.on('mousedown', handleDown);
			}
		}
		
		el.on('mouseover', function(e){
			if(!tid){
				tid = showMenu.defer(150);				
			}
		});
		
		el.on('mouseout', function(e){
			if(tid && !e.within(el, true)){
				clearTimeout(tid);
				tid = 0;				
			}
		});
	}
	
	createMenu('business');
	createMenu('articleclass');
	
		
	
	// expanders
	Ext.getBody().on('click', function(e, t){
		t = Ext.get(t);
		e.stopEvent();
		
		var bd = t.next('div.expandable-body');
		bd.enableDisplayMode();
		var bdi = bd.first();
		var expanded = bd.isVisible();
		
		if(expanded){
			bd.hide();
		}else{
			bdi.hide();
			bd.show();
			bdi.slideIn('l', {duration:.2, stopFx: true, easing:'easeOut'});	
		}
		
		t.update(!expanded ? '<img src="/img/go_off.gif" alt="收缩栏目" class="simg"/>收缩栏目' : '<img src="/img/go_on.gif" alt="展开栏目" class="simg"/>展开栏目');
			
	}, null, {delegate:'a.expander'});
	
	var gs = Ext.get('gsearch-box');
	if(gs){
		gs.on('focus', function(){
			if(gs.getValue() == 'Search with google'){
				gs.dom.value = '';
				gs.up('div').addClass('gs-active');
			}
		});
		
		gs.on('blur', function(){
			if(gs.getValue() == ''){
				gs.dom.value = 'Search with google';
				gs.up('div').removeClass('gs-active');
			}
		});
		
		if(gs.getValue() == ''){
			gs.dom.value = 'Search with google';
		}
	}
	

});






