function insertFlash(elm, url, b , w, h) {
if (!document.getElementById(elm)) return;
var str = '';
str += '<object width="'+ w +'" height="'+ h +'" border="' + b + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">';
str += '<param name="movie" value="'+ url +'">';
str += '<param name="wmode" value="opaque">';
str += '<param name="quality" value="autohigh">';
str += '<embed width="'+ w +'" height="'+ h +'" src="'+ url +'" quality="autohigh" wmode="opaque" type="application/x-shockwave-flash" plugspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
str += '</object>';
document.getElementById(elm).innerHTML = str;
}

function ch_authcode(elm,no){
document.getElementById(elm).src = "/authcode.php?mode=change&no_id=" + no;
}

function get_authcode(elm,no){
document.getElementById(elm).src = "/authcode.php?mode=get&no_id=" + no;
}


function insertAd(elm, msg) {
if (!document.getElementById(elm)) return;
var str = msg;
document.getElementById(elm).innerHTML = str;
}

function insertArea(elm, alm) {
	
if (!document.getElementById(elm)) return;
if (!document.getElementById(alm)) return;

var str = document.getElementById(alm).innerHTML;
document.getElementById(elm).innerHTML = str;
document.getElementById(alm).innerHTML = "";
}

function show_sec(){
//window.status=' LubPower.Net  润滑油行业第一站　Powered By E3.NET 2007';
var t2 = new Date().getTime();
var str =(t2-t1)/1000;
document.getElementById("web_page_runtime").innerHTML = str;
today = new Date();
var day;
var date;
if(today.getDay()==0) day = "星期日"
if(today.getDay()==1) day = "星期一"
if(today.getDay()==2) day = "星期二"
if(today.getDay()==3) day = "星期三"
if(today.getDay()==4) day = "星期四"
if(today.getDay()==5) day = "星期五"
if(today.getDay()==6) day = "星期六"
if(today.getYear()!=""){
	date = today.getYear() + "年" +(today.getMonth() + 1 ) + "月" + today.getDate() + "日";
}else{
	date = "中国润滑油电子商务网";
}
document.getElementById("web_page_today").innerHTML = date;

if(document.getElementById("web_page_member")){
var msg='';
var user = GetCookie('user_id');
if(user==null){
}else{
	msg="欢迎您! " + user + "　<a href=/member/>会员中心</a>";
	document.getElementById("web_page_member").innerHTML = msg;
}
}
}

// JavaScript Document

function check_submit(theForm)
{
	 loop=theForm.elements.length;
	 for(i=0;i<loop;i++){
		 if((theForm.elements[i].value=="" || theForm.elements[i].value=="-") && theForm.elements[i].title!="" ){
			 alert("请输入"+theForm.elements[i].title);
			 theForm.elements[i].focus();
			 return false;
		 }
	 }
  return (true);
}

function google_search(theForm)
{
	 if(check_submit(theForm)){
	theForm.sitesearch.value="";
	theForm.action='http://www.google.com/custom';
	theForm.submit();
	}

}

function site_search(theForm)
{
	 if(check_submit(theForm)){
	 if(theForm.sort.value=="-"){
		 theForm.sitesearch.value="";
		 theForm.action='http://www.google.com/custom';
		 theForm.submit();
	 }else{
		 if(theForm.sort.value=="0"){
			 theForm.sitesearch.value="www.LubPower.net";
			 theForm.action='http://www.google.com/custom';
			 theForm.submit();
		 }else{
		  return (true);
		 }
	 }
	 }
}


function setTab0dSyn(i,classnamebef,idbef,idall,tabtabbef)
{
	var waitInterval;
	
	var MouseDelayTime=150;//鼠标感应延迟300毫秒
//
	
					_gObj(idbef+i).onmouseout=function(aEvent)
					{					
					      
						  clearTimeout(waitInterval);
				    }
			    	clearTimeout(waitInterval);
					
					var str="setTab0dSyn1("+i+",'"+classnamebef+"','"+idbef+"',"+idall+",'"+tabtabbef+"')";
					
					waitInterval=setTimeout(str,MouseDelayTime);
	
}
function aa(i)
{
	alert("aa is run"+i);
}
//----------------------------------------------------------------------------------
function setTab0dSyn1(i,classnamebef,idbef,idall,tabtabbef)
{
//alert(i);
changDivClass(idbef,idall,i,classnamebef)
selectTab0dSyn(tabtabbef,idall,i);
}

function selectTab0dSyn(div_id,allnum,now){
for(var i= 1; i<= allnum;i++)
{
	if(i==now)
	{
		_gObj(div_id+i).style.display="block";
	}else
	{
		_gObj(div_id+i).style.display="none";
	}
}

//	document.getElementById("tabtabd1").style.display="block";
//	document.getElementById("tabtabd2").style.display="none";

}	


function _gObj(id)
{
return document.getElementById(id);
}

function changDivClass(div_id,all,now,classnamebef)
{
for(var i= 1; i<= all;i++)
{
if(i==now)
{
_gObj(div_id+i).className = classnamebef+"_0a";
}else
{
//_gObj(div_id+i).className = "dj4_"+i;
_gObj(div_id+i).className = classnamebef+"_a";
}
}
}


function GetCookieVal(str,offset)
//获得Cookie解码后的值
{
var endstr = str.indexOf (";", offset);
if (endstr == -1)
endstr = str.length;
return unescape(str.substring(offset, endstr));
}

function SetCookie(name, value)
//设定Cookie值
{
var expdate = new Date();
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
+((secure == true) ? "; secure" : "");
}
function DelCookie(name)
//删除Cookie
{
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires="+ exp.toGMTString();
}
function GetCookie(name)
//获得Cookie的原始值
{
var arg = name + "=";
var alen = 0;
var str="";
var cook=document.cookie;
var cook_varlist;
var cook_var;
var start;
var clen;

alen = arg.length;
if(cook.charAt(";")){
	cook_varlist=split(";",cook);
start=cook_varlist.length-1;
cook_var=cook_varlist[start];
clen = cook_var.length;
}else{
cook_var=cook;
clen = cook_var.length;
}
var i = 0;

while (i < clen){
var j = i + alen;
if (cook_var.substring(i, j) == arg){
	str = GetCookieVal (cook_var,j);
	return str; 
}
i = i + 1;
}
return null;
}

function powerpoint(focus_file,focus_width,focus_heigh,text_height,pics,links,texts){
 document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
 document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="'+focus_file+'"><param name="quality" value="high"><param name="bgcolor" value="#FFFFFFF">');
 document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
 document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
 document.write('<embed src="'+focus_file+'" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#F0F0F0" quality="high" width="'+ focus_width +'" height="'+ focus_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');  
 document.write('</object>');
}

function fontZoom(size)
{
 document.getElementById('fontzoom').style.fontSize=size+'px';
}

function ch_page(url,no){
	isNum=/^[0-9]$/;
	if(no==""){
		alert("请输入要转到的页码");
	}else{
		if(isNum.test(no)){
		 window.location=url + no;
		}else{
		 alert("页码输入不正确");
		}
	}
}

function checknumber(String) 
{ 
var Letters = "1234567890-+"; 
var i; 
var c; 
for( i = 0; i < String.length; i ++ ) 
{ 
c = String.charAt( i ); 
if (Letters.indexOf( c ) ==-1) 
{ 
return false; 
} 
} 
return true; 
} 

function split(chr,String) 
{ 
var slide=new Array();
var i; 
var loop=0;
var tmp="";
var c; 
for( i = 0; i < String.length; i ++ ) { 
c = String.charAt( i ); 
if (c == chr) {
	slide[loop] = tmp;
//	alert( slide[loop]);
	loop++;
	tmp="";
}else{
	tmp=tmp+c;
}
} 
if(tmp.length>0){
	slide[loop] = tmp;
//	alert( slide[loop]);
}
return slide; 
} 
