// JavaScript Document

function my_li_1(obj){
document.getElementsByTagName("li")[0];
obj.className = "li_block";
}
function my_li_2(obj){
document.getElementsByTagName("li")[0];
obj.className = "";
} 

function sp_list() {
	var mEls = document.getElementById("list1").getElementsByTagName("li");
	for (var i=0; i<mEls.length; i++)
	{
		mEls[i].onmouseover=function() 
		{
			this.className+=(this.className.length>0? " ": "") + "mhover";
		}
		mEls[i].onMouseDown=function() 
		{
			this.className+=(this.className.length>0? " ": "") + "mhover";
		}
		mEls[i].onMouseUp=function() 
		{
			this.className+=(this.className.length>0? " ": "") + "mhover";
		}
		mEls[i].onmouseout=function()
		{
			this.className=this.className.replace(new RegExp("( ?|^)mhover\\b"),"");
		}
	}
}

function changeTab(id,currentTab,tabCount) //id：将要显示的层；currentTab：当前元素id；tabCount：切换元素总数
{
	for(var i=1;i<=tabCount;i++)
	{
		document.getElementById(id+i).style.display="none";
		if(id == 'info'){
			document.getElementById("tab"+i).style.background = "url(/style/images/sy_4.gif) 0px 3px no-repeat";
			document.getElementById("tab"+i).style.width = "62px";
			document.getElementById("tab"+i).style.height = "26px";
			document.getElementById("tab_"+i).style.fontWeight = "normal";
			document.getElementById("tab_"+i).style.fontSize = "12px";
		}

		if(id == 'info_'){
			document.getElementById("tabb_"+i).style.background = "url(/style/images/sy_bg19.gif) right top no-repeat ";
			document.getElementById("tabb_"+i).style.color = "";
		}

		if(id == 'info_g'){
			document.getElementById("g_"+i).style.background = "url(/style/images/goods_32.gif) right top no-repeat ";
			document.getElementById("g_"+i).style.color = "";
		}

		if(id == 'cha_'){
			document.getElementById("ch_"+i).style.background = "url(/style/images/channel_11.gif) repeat ";
			document.getElementById("ch_"+i).style.color = "#828282";
		}

		if(id == 'comm_'){
			document.getElementById("com"+i).style.color = "";
		}

		if(id == 'qzj_'){
			document.getElementById("qzj"+i).style.background = "";
			document.getElementById("qzj"+i).style.color = "#FFFFFF";
		}
	}
	
	document.getElementById(id+currentTab).style.display="block";

	if(id == 'info'){		
		document.getElementById("tab"+currentTab).style.background = "url(/style/images/sy_5.gif) 0px 0px no-repeat";
		document.getElementById("tab"+currentTab).style.width = "84px";
		document.getElementById("tab"+currentTab).style.height = "26px";
		document.getElementById("tab_"+currentTab).style.fontWeight = "bold";
		document.getElementById("tab_"+currentTab).style.fontSize = "14px";
	}

	if(id == 'info_'){
		document.getElementById("tabb_"+currentTab).style.background = "url(/style/images/sy_bg18.gif) no-repeat ";
		document.getElementById("tabb_"+currentTab).style.color = "#FFFFFF";
	}

	if(id == 'info_g'){
		document.getElementById("g_"+currentTab).style.background = "url(/style/images/goods_30.gif) right top no-repeat ";
		document.getElementById("g_"+currentTab).style.color = "#FFFFFF";
	}

	if(id == 'cha_'){
		document.getElementById("ch_"+currentTab).style.background = "url(/style/images/channel_12.gif) repeat ";
		document.getElementById("ch_"+currentTab).style.color = "#FFFFFF";
	}

	if(id == 'comm_'){
		document.getElementById("com"+currentTab).style.color = "#117212";
	}

	if(id == 'qzj_'){
		document.getElementById("qzj"+currentTab).style.background = "url(/style/css/zt/images/qzj_04.gif)";
		document.getElementById("qzj"+currentTab).style.color = "#333333";
	}
}


function checksear(){
var s = document.getElementById("key");
 if(s.value){
	 return true;
 }
 else{
	alert('请输入关键词');
	document.getElementById("key").value = '';
	document.getElementById("key").focus();
	return false;
 }
}



document.getCookie = function(sName)
{
	if(sName == 'un') sName = 'ECS[username]';
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0])
      return decodeURIComponent(aCrumb[1]);
  }

  // a cookie with the requested name does not exist
  return null;
}



function addFavorite(){
var sURL = location.href;
var sTitle = document.title;
	try
	{
		window.external.addFavorite(sURL, sTitle);
	}
	catch (e)
	{
		try
		{
			window.sidebar.addPanel(sTitle, sURL, "");
		}
		catch (e)
		{
			var c = "ctrl";
			if(navigator.platform.match(/mac/i)){
				 c = "command"
			}
			alert("请使用键盘上\n\n"+c+"+D\n\n进行收藏操作。");
		}
	}
	return false;
}


function sigleMove(id,left,right,width,width1,quick,quick1, auto){

		var scrollPic_02 = new ScrollPic();
		scrollPic_02.scrollContId   = id; //内容容器ID
		scrollPic_02.arrLeftId      = left;//左箭头ID
		scrollPic_02.arrRightId     = right; //右箭头ID

		scrollPic_02.frameWidth     = width;//显示框宽度
		scrollPic_02.pageWidth      = width1; //翻页宽度

		scrollPic_02.speed          = quick; //移动速度(单位毫秒，越小越快)
		scrollPic_02.space          = quick1; //每次移动像素(单位px，越大越快)
		scrollPic_02.autoPlay       = auto; //自动播放
		scrollPic_02.autoPlayTime   = 3; //自动播放间隔时间(秒)

		scrollPic_02.initialize(); //初始化
}

var t;
function lefttime(end){
	now = new Date();
	var begin = now.getTime()/1000;
	var left = end - begin;
	var hour = parseInt(left/3600);
	var hour_left = left%3600;
	var minites = parseInt(hour_left/60);
	var minites_left = hour_left%60;
	var second = parseInt(minites_left%60);
	//alert(hour+'|'+minites+'|'+second);
	if(hour < 10) hour = '0'+hour;
	if(minites < 10) minites = '0'+minites;
	if(second < 10) second = '0'+second;
	document.getElementById('hour').innerHTML = hour;
	document.getElementById('minites').innerHTML = minites;
	document.getElementById('second').innerHTML = second;
	t = setTimeout('lefttime('+end+')','1000');
}


var ms;
function lefttime_ms(id,end){
	now = new Date();
	var begin = now.getTime()/1000;
	var left = end - begin;
	var hour = parseInt(left/3600);
	var hour_left = left%3600;
	var minites = parseInt(hour_left/60);
	var minites_left = hour_left%60;
	var second = parseInt(minites_left%60);
	//alert(hour+'|'+minites+'|'+second);
	if(hour < 10) hour = '0'+hour;
	if(minites < 10) minites = '0'+minites;
	if(second < 10) second = '0'+second;
	document.getElementById('hour_'+id).innerHTML = hour;
	document.getElementById('minites_'+id).innerHTML = minites;
	document.getElementById('second_'+id).innerHTML = second;
	ms = setTimeout('lefttime_ms('+id+','+end+')','1000');
}
