// JavaScript Document
function g(e){
	return document.getElementById(e);
}
function hr(){
var newin=window.open("/redirect.asp");
}
function contactus(){
var u="http://www.918kf.com/client.aspx?worker_id=742216";
var w=690;
var h=500;
var l = (screen.width - w) / 2; 
var t = (screen.height - h) / 2; 
var s = 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l; 
s += ', toolbar=no, scrollbars=no, menubar=no, location=no, resizable=no'; 
open(u, 'oWin', s); 
}
function textCounter(field, countfield, maxlimit) {  
// 函数，3个参数，表单名字，表单域元素名，限制字符；  
if (field.value.length > maxlimit)  
//如果元素区字符数大于最大字符数，按照最大字符数截断；  
field.value = field.value.substring(0, maxlimit);  
else  
//在记数区文本框内显示剩余的字符数；  
countfield.value = maxlimit - field.value.length;  
}  
function check_close(count){
                if (count == 1) {
				document.getElementById("Dpop").style.display= "none";
				document.getElementById("Dquote").style.display= "block";
				scall()
				}
				if (count == 2) {
				document.getElementById("Dpop").style.display= "block";
				document.getElementById("Dquote").style.display= "none";
				scall()
				window.frames["kefu"].location.reload();
				}
				if (count == 3) {
				document.getElementById("Dpop").style.display= "none";
				document.getElementById("Dquote").style.display= "none";
				scall()
				}
 } 

function scpop(){
 if(document.getElementById("Dquote").style.display=="block")
    {
        document.getElementById("Javascript.Div3").style.top=(document.documentElement.scrollTop+document.documentElement.clientHeight-document.getElementById("Javascript.Div3").offsetHeight)-"16"+"px";
        document.getElementById("Javascript.Div3").style.left=(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById("Javascript.Div3").offsetWidth)+"px";
    }
 if(document.getElementById("Dpop").style.display=="block")
	{
		document.getElementById("Javascript.Div3").style.top=(document.documentElement.scrollTop)+"px";
　　	document.getElementById("Javascript.Div3").style.left=(document.documentElement.scrollLeft)+"px";
	}
}
function copyurl(){
	var myHerf=top.location.href;
	var title=document.title;
	if(window.clipboardData){
	var tempCurLink=title + "\n" + myHerf;
	var ok=window.clipboardData.setData("Text",tempCurLink);
	if(ok)alert("按Ctrl+V ,粘贴地址发给你的好友们吧 ！");
	}else{alert("对不起，目前此功能只支持IE，请直接复制地址栏的地址！");}
}
function chgmenu(e){
	switch(e){
	case "home":
	g("menu_home").src="/skin/bestsonny/menu_home1.gif"
	break;
	case "about":
	g("menu_about").src="/skin/bestsonny/menu_about1.gif"
	break;
	case "mobile":
	g("menu_mobile").src="/skin/bestsonny/menu_mobile1.gif"
	break;
	case "bbs":
	g("menu_bbs").src="/skin/bestsonny/menu_bbs1.gif"
	break;
	case "news":
	g("menu_news").src="/skin/bestsonny/menu_news1.gif"
	break;
	case "ask":
	g("menu_ask").src="/skin/bestsonny/menu_ask1.gif"
	break;
	case "space":
	g("menu_space").src="/skin/bestsonny/menu_space1.gif"
	break;
	case "service":
	g("menu_service").src="/skin/bestsonny/menu_service1.gif"
	break;
	case "fun":
	g("menu_fun").src="/skin/bestsonny/menu_fun1.gif"
	break;
	case "quality":
	g("menu_quality").src="/skin/bestsonny/menu_quality1.gif"
	break;
	case "brand":
	g("menu_brand").src="/skin/bestsonny/menu_brand1.gif"
	break;
	case "diy":
	g("menu_diy").src="/skin/bestsonny/menu_diy1.gif"
	break;
	}
}
function setmenu(e){
	switch(e){
	case "home":
	g("menu_home").src="/skin/bestsonny/menu_home0.gif"
	break;
	case "about":
	g("menu_about").src="/skin/bestsonny/menu_about0.gif"
	break;
	case "mobile":
	g("menu_mobile").src="/skin/bestsonny/menu_mobile0.gif"
	break;
	case "bbs":
	g("menu_bbs").src="/skin/bestsonny/menu_bbs0.gif"
	break;
	case "news":
	g("menu_news").src="/skin/bestsonny/menu_news0.gif"
	break;
	case "ask":
	g("menu_ask").src="/skin/bestsonny/menu_ask0.gif"
	break;
	case "space":
	g("menu_space").src="/skin/bestsonny/menu_space0.gif"
	break;
	case "service":
	g("menu_service").src="/skin/bestsonny/menu_service0.gif"
	break;
	case "fun":
	g("menu_fun").src="/skin/bestsonny/menu_fun0.gif"
	break;
	case "brand":
	g("menu_brand").src="/skin/bestsonny/menu_brand0.gif"
	break;
	case "quality":
	g("menu_quality").src="/skin/bestsonny/menu_quality0.gif"
	break;
	case "diy":
	g("menu_diy").src="/skin/bestsonny/menu_diy0.gif"
	break;
	}
}
function chgcontent(obj){
	switch(obj){
	case 0:
	g("title").innerHTML="方针特点";
	g("fztd").style.display="block";
	g("spjs").style.display="none";
	g("scjcsb").style.display="none";
	g("quality_fztd").src="/common/images/quality_fztd2.jpg";
	g("quality_scjcsb").src="/common/images/quality_scjcsb.jpg";
	g("quality_spjs").src="/common/images/quality_spjs.jpg";
	break;
	case 1:
	g("title").innerHTML="生产检测设备";
	g("fztd").style.display="none";
	g("spjs").style.display="none";
	g("scjcsb").style.display="block";
	g("quality_fztd").src="/common/images/quality_fztd.jpg";
	g("quality_scjcsb").src="/common/images/quality_scjcsb2.jpg";
	g("quality_spjs").src="/common/images/quality_spjs.jpg";
	break;
	case 2:
	g("title").innerHTML="视频介绍";
	g("fztd").style.display="none";
	g("spjs").style.display="block";
	g("scjcsb").style.display="none";
	g("quality_fztd").src="/common/images/quality_fztd.jpg";
	g("quality_scjcsb").src="/common/images/quality_scjcsb.jpg";
	g("quality_spjs").src="/common/images/quality_spjs2.jpg";
	break;
	}
}
function flash(ur1,w1,h1){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w1+'" height="'+h1+'">');
	document.write('<param name="movie" value="' + ur1 + '">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<param name="menu" value="false">');
	document.write('<embed src="' + ur1 + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + w1 + '" height="' + h1 + '"></embed>');
	document.write('</object>');		
}
/*function homevideo(){
	var url;
	url = "http://www.8d27.cn/video/530.flv"//http://www.8d27.cn/video/bestsonny.flv
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="211" height="160">');
	document.writeln('<param name="movie" value="/v/flvplayer.swf?flvpath='+url+'&imgpath=/v/img/v530.jpg">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<embed src="/v/flvplayer.swf?flvpath='+url+'&imgpath=/v/img/v530.jpg" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="211" height="160" wmode="transparent"></embed>');
	document.writeln('</object>');		
}*/
function homevideo(){	
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="211" height="160">');
	document.writeln('<param name="movie" value="index.swf">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<embed src="index.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="211" height="160" wmode="transparent"></embed>');
	document.writeln('</object>');		
}
function svideo(url,w,h,pic){
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width='+w+' height='+h+'>');
	document.writeln('<param name="movie" value="/v/flvplayer.swf?flvpath='+url+'&imgpath='+pic+' />');
	document.writeln('<param name="quality" value="high" />');
	document.writeln('<embed src="/v/flvplayer.swf?flvpath='+url+'&imgpath='+pic+' quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width='+w+' height='+h+' wmode="transparent"></embed>');
	document.writeln('</object>');		
}
function _play(val,txt,pic){
	var so1 = new SWFObject('/skin/bestsonny/player.swf','flv','470','340','8', '#ffffff');
	so1.addParam('allowfullscreen','true');
	so1.addParam('allowscriptaccess','always');
	so1.addParam('wmode', 'opaque');
	so1.addParam('file', 'http://'+val);
	so1.addParam('image', '/skin/bestsonny/'+pic);
	so1.addParam('volume', '50');
	so1.addParam('flashvars','file=http://'+val+'&image=/skin/bestsonny/'+pic+'&skin=/skin/bestsonny/stylish.swf&volume=80&bufferlength=5&fullscreen=true&stretching=exactfit&controlbar=over&allowscriptaccess=always&allowfullscreen=true');		
	so1.addVariable('bufferlength', '5');
	so1.addVariable('fullscreen', 'true');
	so1.addVariable('stretching', 'exactfit');
	so1.addVariable('controlbar', 'over');
	so1.addVariable('backcolor', 'ffffff');
	so1.addVariable('frontcolor', 'cccccc');
	so1.addVariable('lightcolor', '66cc00');
	so1.addVariable('screencolor', '');
	so1.addVariable('skin', '/skin/bestsonny/stylish.swf');
	so1.addVariable('autostart', 'true');
	so1.write('playcontent');
	g("playtitle").innerHTML=txt;		
}
function smenu(e){
	switch(e){
	case "about":
	g("div_about").innerHTML='<img src="/skin/bestsonny/menu_about1.gif" border="0" />';
	break;
	case "mobile":
	g("div_mobile").innerHTML='<img src="/skin/bestsonny/menu_mobile1.gif" border="0" />';
	break;
	case "news":
	g("div_news").innerHTML='<img src="/skin/bestsonny/menu_news1.gif" border="0" />';
	break;
	case "service":
	g("div_service").innerHTML='<img src="/skin/bestsonny/menu_service1.gif" border="0" />';
	break;
	case "fun":
	g("div_fun").innerHTML='<img src="/skin/bestsonny/menu_fun1.gif" border="0" />';
	break;	
	case "diy":
	g("div_diy").innerHTML='<img src="/skin/bestsonny/menu_diy1.gif" border="0" />';
	break;	
	}
}
var ajaxreq=false,ajaxCallback;
function ajaxRequest(filename){
    try{
		//Firefox / IE7 / Others
		ajaxreq=new XMLHttpRequest();
		}
	catch(error){
		try{
			// IE5 / IE6
			ajaxreq=new ActiveXObject("Microsoft.XMLHTTP");
			}
		catch(error){
			return false;
			}
		}
	ajaxreq.open("GET",filename);
	ajaxreq.onreadystatechange=ajaxResponse;
	ajaxreq.send(null);
}
function ajaxResponse(){
    if(ajaxreq.readyState!=4) return;
	if(ajaxreq.status==200){
		if(ajaxCallback) ajaxCallback();
	}else alert("Request failed: "+ajaxreq.statusText);
	return true;
}
function getajax(obj,e){
    if(!e) return;
	g(obj).innerHTML = '加载中,请稍等...';
    ajaxCallback=function(){
     var req=ajaxreq.responseText;
	 if(req!="norecord"){
	 g(obj).innerHTML = req;
	 }
	}
	url="/common/getajax.asp?typ="+e;
	ajaxRequest(url);
}
function ajaxproduct(e){
	if(!e) return;
	g("spanjx").innerHTML = '加载中,请稍等...';
    ajaxCallback=function(){
     var req=ajaxreq.responseText;
	 if(req!="norecord"){
	 g("spanjx").innerHTML = req;
	 }
	}
	url="/common/getajax.asp?typ=jx&val="+e;
	ajaxRequest(url);
}
function ajaxproductmess(prodid,username,tel,content){
	if(!content) return;
	g("spanprodmess").innerHTML = '加载中,请稍等...';
    ajaxCallback=function(){
     var req=ajaxreq.responseText;
	 if(req!="norecord"){
	 g("spanprodmess").innerHTML = req;
	 g("mname").value="";
	 g("mtel").value="";
	 g("mcontent").value="";
	 g("madd").style.display = "none";
	 }else{
	 g("spanprodmess").innerHTML = "您已经对此产品提交过留言了";
	 g("mname").value="";
	 g("mtel").value="";
	 g("mcontent").value="";
	 g("madd").style.display = "none";
	 }
	}
	url="/common/getajax.asp?typ=prodmess&prodid="+prodid+"&username="+username+"&tel="+tel+"&content="+content;
	ajaxRequest(url);
}
function goitem(e){
	window.location.href="/product/items.asp?product="+e;
}
var prox;
var proy;
var proxc;
var proyc;
function show(url,w,h){/*--打开--*/
var str = '<iframe src='+url+' frameborder="0" width='+(w-10)+' height='+(h-20)+' name="sframe" id="sframe"></iframe>';
str = str + "<div>[<span onclick='closeed()'>关闭</span>]</div>";
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById("box");
o.style.display = "block";
o.style.width = w;
o.style.height = h; 
o.innerHTML = str;
sframe.location.reload();
prox = setInterval(function(){openx(o,500)},10);
}
function openx(o,x){/*--打开x--*/
var cx = parseInt(o.style.width);
if(cx < x)
{
o.style.width = (cx + Math.ceil((x-cx)/5)) +"px";
}
else
{
clearInterval(prox);
proy = setInterval(function(){openy(o,200)},10);
}
}
function openy(o,y){/*--打开y--*/
var cy = parseInt(o.style.height);
if(cy < y)
{
o.style.height = (cy + Math.ceil((y-cy)/5)) +"px";
}
else
{
clearInterval(proy);
}
}
function closeed(){/*--关闭--*/
clearInterval(prox);
clearInterval(proy);
clearInterval(proxc);
clearInterval(proyc);
var o = document.getElementById("box");
if(o.style.display == "block")
{
proyc = setInterval(function(){closey(o)},10);
}
}
function closey(o){/*--打开y--*/
var cy = parseInt(o.style.height);
if(cy > 0)
{
o.style.height = (cy - Math.ceil(cy/5)) +"px";
}
else
{
clearInterval(proyc);
proxc = setInterval(function(){closex(o)},10);
}
}
function closex(o){/*--打开x--*/
var cx = parseInt(o.style.width);
if(cx > 0)
{
o.style.width = (cx - Math.ceil(cx/5)) +"px";
}
else
{
clearInterval(proxc);
o.style.display = "none";
}
}