﻿/*the browser is ie  or firefox or others*/
var ie6=0;
 if(navigator.userAgent.indexOf("IE 6") > -1){
	ie6=1
}

var Browser = new Object();
Browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
Browser.isIE = window.ActiveXObject ? true : false;
Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox")!=-1);
Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);

var dealer_info_obj = document.getElementById('detail_dealer_info');

//添加收藏夹
function add_favorite(){
	var d = new Date();
	var url=document.URL;
	var title=document.title;
	if (document.all) window.external.AddFavorite(url,title);
	else if (window.sidebar) window.sidebar.addPanel(title,url,"");
}
/*构造ajax对象*/
function AjaxObject(){
  var request = null;
  try{
    request = new ActiveXObject("Msxml2.XMLHTTP");
  }catch (e){
    try{
      request = new ActiveXObject("Microsoft.XMLHTTP");
    }catch (oc){
      request = null;
    }
  }
  if (!request && typeof XMLHttpRequest != "undefined"){
    try{
      request =  new XMLHttpRequest();
    }catch (fa){
      alert("抱歉，您的浏览器不支持这个功能，请选择IE 6.0或FireFox浏览器。")
      request = null;
    }
  }
  return request;
}

function showlayer(layer_name){
	var hidden_layer = document.getElementById(layer_name);
	hidden_layer.style.display = hidden_layer.style.display==''?'none':'';
}
function showMailLayer(i){
	eval("zol_email_send_Layer1_"+i+".style.display=zol_email_send_Layer1_"+i+".style.display==''?'none':''");
	if(i!='more')
	eval("document.frm_mail_"+i+".backUrl.value=window.location.href");
}

//用指定的字符串div切开str字符串后返回一个数组 
function stringToArray(str,div){
	objArr = str.split(div);
	return objArr;
}

function readCookie(name)
{
  var cookieValue = "";
  var search_s = name + "=";
  if(document.cookie.length > 0)
  { 
	offset = document.cookie.indexOf(search_s);
	if (offset != -1)
	{ 
	  offset += search_s.length;
	  end = document.cookie.indexOf(";", offset);
	  if (end == -1) end = document.cookie.length;
	  cookieValue = unescape(document.cookie.substring(offset, end))
	}
  }
  return cookieValue;
}

function reads(varname){
	var tmp_ary = new Array();
	if (varname){
		var a = document.cookie.indexOf(varname+"=");
		if (a != -1){
			var b = document.cookie.substring((a+varname.length+1),document.cookie.length);
			var c = b.split(";");
			var d = c[0];
			return d;
		}
	}
}
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire + ";domain=.zol.com.cn;path=/; ";
}

//if(top.location!= self.location){
//	//alert('nihao');
//	if(typeof(var_subcatid)!='undefined'){
//		top.location.href = 'http://product.it168.com/';
//	}
//}else{
//	setTimeout("alt()",3000);
//}

function copyToClipBoard(){
    var clipBoardContent="";
    clipBoardContent+=window.location.href;
    if (window.clipboardData){
    	if(window.clipboardData.setData("Text",clipBoardContent)){
    		alert("复制成功！");   
    	}
    }else{
    	var flashcopier = 'flashcopier';
		if(!document.getElementById(flashcopier)) {
    		var divholder = document.createElement('div');
    		divholder.id = flashcopier;
    		document.body.appendChild(divholder);
		}
		document.getElementById(flashcopier).innerHTML = '';
		clipBoardContent = clipBoardContent.replace(/\"/g,'\'');
		var divinfo = '<embed src="/_clipboard.swf" FlashVars="clipboard='+clipBoardContent+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
		document.getElementById(flashcopier).innerHTML = divinfo;
		alert("复制成功！");
   }
}

/*****************
*获得鼠标坐标
******************/
var mousex;
var mousey;
window.document.onmousemove=function(evt){
    evt=evt || window.event;
    mousex=evt.clientX;
    mousey=evt.clientY; 
}
var initialvisible=0;
function drc(text,title) {
	//dtc(1,text,title);
	document.getElementById("overDiv").innerHTML="<TABLE WIDTH='200' BORDER=0 CELLPADDING='1' CELLSPACING=0 BGCOLOR=\"#333399\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><SPAN ID=\"PTT\"><B><FONT COLOR=\"#FFFFFF\" >"+title+"</FONT></B></SPAN></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\"#CCCCFF\"><TR><TD><SPAN ID=\"PST\"><FONT COLOR=\"#000000\">"+text+"</FONT><SPAN></TD></TR></TABLE></TD></TR></TABLE>";
	if (initialvisible==0){
	document.getElementById("overDiv").style.visibility="visible";
	initialvisible=1;
	}
	document.getElementById("overDiv").style.left=(document.body.scrollLeft?document.body.scrollLeft:document.documentElement.scrollLeft)+mousex+10+'px';
	document.getElementById("overDiv").style.top=(document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+mousey+10+'px';
	
}
// Clears popups if appropriate
function nd() {
	document.getElementById("overDiv").style.visibility="hidden";
	initialvisible = 0;
}
// JavaScript Document

function hidden_nav(conname,num){
	var con_obj = typeof(conname)=='object' ? conname : document.getElementById(conname);
	var hidden_nav_obj = cp_hidden_nav = [];
	var i = m=0;
	var hidden_nav_con = document.getElementById('hidden_nav_con');
	var hidden_nav_obj = hidden_nav_con.getElementsByTagName('a');
	var hidden_nav_num = hidden_nav_obj.length;
	var k = hidden_nav_num-num;
	while(m<num){
		var nav_id = hidden_nav_obj[i].id;
		if((nav_id+'.shtml')==('top_'+base_name) || nav_id == 'top_review' || m<k){
			con_obj.appendChild(hidden_nav_obj[i]);
			m++;
			continue;
		}
		hidden_nav_obj[i].className='';
		cp_hidden_nav[m] = hidden_nav_obj[i].cloneNode(true);
		m++;
		i++;
	}
	hidden_nav_str = '<div onmouseover="document.getElementById(\'nav_more\').style.display=\'block\';document.getElementById(\'nav_more_m\').style.display=\'none\'" onmouseout="document.getElementById(\'nav_more\').style.display=\'none\';document.getElementById(\'nav_more_m\').style.display=\'block\';">';
	hidden_nav_str += '  <div>';
	hidden_nav_str += '    <div class="add_nav_more_menu" id="nav_more" style="z-index:9000">';
	hidden_nav_str += '      <div class="add_nav_more_m">更多</div>';
	hidden_nav_str += '    </div>';
	hidden_nav_str += '  </div>';
	hidden_nav_str += '  <div class="add_nav_more_m" id="nav_more_m">更多</div>';
	hidden_nav_str += '</div>';
	con_obj.innerHTML += hidden_nav_str;
	for(key in cp_hidden_nav){
		document.getElementById('nav_more').appendChild(cp_hidden_nav[key]);
	}
}
function in_array(needle, haystack) {
	if(typeof needle == 'string') {
		for(var i in haystack) {
			if(haystack[i] == needle) {
				return true;
			}
		}
	}
	return false;
}

//window.onerror=function(){return true}

function submitfrm(divobj){
    var val="";
    if(Browser.isIE){
        val = divobj.firstChild.innerText;
    }else if(Browser.isFirefox){
        val = divobj.firstChild.textContent;
    }
	var obj3=window.frames["sch_iframe"];
	var ky=obj3.window.document.getElementById("key_word");
    ky.value=val;
	var form_obj=obj3.window.document.all.searchform;
	form_obj.submit();
}

var al_spell = '';
var o_spell = '';
var now_spell = '';
var at,vflag=false;
function show_spell(spell_str,old_spell)
{
	clearTimeout(at);
vflag = true;
	document.getElementById(spell_str).className='act';
	at = setTimeout("get_spell('"+spell_str+"','"+old_spell+"')",200);

}
function clear_spell(spell_str,old_spell)
{
	vflag = false;
	cannel_spell(spell_str,old_spell);
	clearTimeout(at);
}
function get_spell(spell_str,old_spell){
//document.getElementById("show_sub").innerHTML = '正在读取......';
	now_spell = spell_str;
	document.getElementById(spell_str).className='act';
	if(old_spell){
		document.getElementById(old_spell).className='bdn';
	}
	document.getElementById('show_sub').style.display='block';
	if(al_spell && al_spell!=spell_str){
		document.getElementById(al_spell).className='normo';
		if(o_spell){
		document.getElementById(o_spell).className='normo';
		}
	}
	al_spell = spell_str;
	o_spell = old_spell;
	var result = "",div_count="";
   var weburl = "/brand/AjaxCharOrder/DefaultAll.aspx?charKey="+spell_str;
   //alert(weburl);
    //try
    //{
       var xmlhttp = jb();
       xmlhttp.open("get",weburl,true);
       xmlhttp.onreadystatechange=function()
       {
	     if(xmlhttp.readyState==4)//4代表成功返回数据
	     {
	        
		    if(200==xmlhttp.status)
		    {
			    result = xmlhttp.responseText;//得到服务器返回的数据 				
		    }
		    else{result = "网络错误，请重试！！";}
		    if(result!="")
		    {
			    document.getElementById("show_sub").innerHTML=result;
		    }
	      }
	}
	xmlhttp.send(null);
    //}
	//document.getElementById("show_sub").innerHTML = '正在读取......';
     // catch(e){
      //  alert(e);
      //}
}
function cannel_spell(spell_str,old_spell){
	if(old_spell){
		document.getElementById(old_spell).className='normo';
	}
	document.getElementById(spell_str).className='normo';
	document.getElementById('show_sub').style.display='none';
}
function get_hidden_spell(){
	if(now_spell){
		document.getElementById(now_spell).className = 'act';
	}
	if(o_spell){
		document.getElementById(o_spell).className='bdn';
	}
	document.getElementById('show_sub').style.display='block';
}
function cannel_hidden_spell(){
	if(now_spell){
		document.getElementById(now_spell).className = 'normo';
	}
	if(o_spell){
		document.getElementById(o_spell).className='normo';
	}
	document.getElementById('show_sub').style.display='none';
}
 function jb()
 {
	var A=null; 
	try 
	{ 
		 A=new ActiveXObject("Msxml2.XMLHTTP"); 
	} 
	catch(e)
	{ 
		  try 
		   { 
			  A=new ActiveXObject("Microsoft.XMLHTTP"); 
		   }
		catch(oc)
		{ 
			 A=null 
		} 
	} 
	if ( !A && typeof XMLHttpRequest != "undefined" ) 
	{ 
	   A=new XMLHttpRequest() 
	} 
	return A 
 }
var aa;
function dis_brand1(bcode,bhid)
{
	var MouseDelayTime1=150;//鼠标感应延迟300毫秒	
	document.getElementById(bcode).style.display='block';
	document.getElementById(bhid).onmouseout=function(aEvent)
	{
		 aa = setTimeout("brand2_none('"+bcode+"')",MouseDelayTime1);
	//bba();
	}
}
function dis_brand2(bcode)
{
    clearTimeout(aa);
	document.getElementById(bcode).style.display='block';
	
}
function brand2_none(b)
{
	//alert(b);
	document.getElementById(b).style.display="none";
}