﻿//fclr, fhclr, bg, bgh
//"#ffffff\",\"#ffffff\",\"#2F3540\",\"#999999\"

function AutoKeyHeight()
{
	return "22";
}

function AutoKeyWidth()
{
	return "92";
}

function MenuChild(menuobj)
{
	menuobj.hideOnMouseOut=true;
	menuobj.bgColor="#ABABAB";//'#555555';
	menuobj.menuBorder=0;
	menuobj.menuLiteBgColor='#FFFFFF';
	menuobj.menuBorderBgColor='#777777';
	menuobj.ChildBorderBgColor='#777777';
	
}

function Menu(label,pad, space, to, sx, sy, srel, opq, vert, idt, aw, ah,acw)  
{
	this.version = "020320 [Menu; mm_menu.js]";
	this.type = "Menu";
	this.menuWidth =155;// mw;
	this.menuChildWidth =acw;// mw;
	this.menuItemHeight =22 ;//mh;
	this.fontSize =12;// fs;
	this.fontWeight = "plain";
	this.fontFamily ="宋体";// fnt; 
	this.fontColor ="#313131";// fclr;
	this.fontColorHilite ="#313131";// fhclr;
	this.menuItemBgColor ="#D4CADC";// bg;
	this.menuHiliteBgColor ="#BAA4CC";// bgh;
	this.bgColor = "#F5E7FE"; //#555555;
	this.menuBorder = 1;
	this.menuBgOpaque=opq;
	this.menuItemBorder = 1;
	this.menuItemIndent = idt;
			
	this.menuItemVAlign = "middle";// valgn;
	this.menuItemHAlign = "left";//halgn;
	this.menuItemPadding = pad;
	this.menuItemSpacing = space;
	this.menuLiteBgColor = "#ffffff";
	this.menuBorderBgColor = "#777777";
		
	this.menuContainerBgColor = "#cccccc";
	this.childMenuIcon = "arrows.gif";
	this.submenuXOffset = sx;
	this.submenuYOffset = sy;
	this.submenuRelativeToItem = srel;
	this.vertical = vert;
	this.items = new Array();
	this.actions = new Array();
	this.childMenus = new Array();
	this.hideOnMouseOut = true;
	this.hideTimeout = to;
	this.addMenuItem = addMenuItem;
	this.writeMenus = writeMenus;
	this.MM_showMenu = MM_showMenu;
	this.onMenuItemOver = onMenuItemOver;
	this.onMenuItemAction = onMenuItemAction;
	this.hideMenu = hideMenu;
	this.hideChildMenu = hideChildMenu;
	if (!window.menus) window.menus = new Array();
	this.label = " " + label;
	window.menus[this.label] = this;
	window.menus[window.menus.length] = this;
	if (!window.activeMenus) window.activeMenus = new Array();
}

function RunJavascript()
{
	
	ShowToTop();
} 


function ShowToTop()
{//显示是否返回页首的链接
	var sh = document.body.scrollHeight || document.documentElement.scrollHeight;
	
	if(sh>1000)
	{
		$('divtotop').style.display="";
	}
	else
	{
		$('divtotop').style.display="none";
	}
} 

function SelectInfoDiv(i_sel)
{
	for(i=1;i<4;i++)
	{
		$('divicon'+i).className="nodsp";
		$('lit'+i).className="";
		
	}
	$('divicon'+i_sel).className="";
	$('lit'+i_sel).className="current";
}



function ShowClassBar(i_id)
{
	var evt = window.event || arguments.callee.caller.arguments[0]; // 获取event对象
  var srcElement = evt.srcElement || evt.target;  // 获取触发事件的源对象
  
		if($('ul'+i_id).className=="")
		{
			$('ul'+i_id).className="nodsp";
			srcElement.src=srcElement.src.replace("minus","plus");
		}
		else
		{
			$('ul'+i_id).className="";
			srcElement.src=srcElement.src.replace("plus","minus")	;
		}
}

function OpenService(i_sel)
{
	var s_source="";
	if(i_sel==1)
	{
		s_source=location.href;
		window.open('/user/chat/default.aspx?sel=1&rnd='+Math.random()+'&source='+s_source,'_blank','scrollbars=no,width=510,height=480,left='+(screen.width-510)/2+',top='+(screen.height-480)/2+',status=no,resizable=yes')
	}
	else
	{
		popup_open("/user/chat/default.aspx?rnd="+Math.random()+"&source="+s_source,"在线客服咨询中心",510,465);	
	}
	
	
}

function setNavBar(s_id)
{
	if($("top"+s_id)!=null)
		$("top"+s_id).className ="bg";
		
}

function ShowBar(ahrobj,i_index)
{
	
	for(var i=0;i<10;i++)
	{
		if($('ahr'+i)==null)
			break;
		
		$('ahr'+i).className="";
		$('div'+i).style.display="none";
	}
	
	$('ahr'+i_index).className="on";
	$('div'+i_index).style.display="block";
}

var i_timeout=0;
var i_last=0;
function ShowMenu(i)
{
	
	if(i_last>0)
	{
		HideMenuDo();
	}
	
	clearTimeout(i_timeout);
	$('divmenu'+i).style.display="";
	
	$('ahrmenu'+i).className="on";
	
	
	i_last=i;
}

function HideMenu()
{
	i_timeout=setTimeout("HideMenuDo()",800);
}

function HideMenuDo()
{
	$('divmenu'+i_last).style.display='none';
	$('ahrmenu'+i_last).className="";
}



function ShowLeftBar(i_id)
{
	var objs=$('ulbar').getElementsByTagName("dl");
	
	for(var i=0;i<objs.length;i++)
	{
		if(objs[i].className=="bar")
		{
			objs[i].style.display="none";
			$(objs[i].id.replace("divbar","li")).className="";
		}	
		
	}
	
	if($('divbar'+i_id)!=null)
	{
		$('divbar'+i_id).style.display="";
		$('li'+i_id).className="selected";
	}	
}

function ShowLeftBarLink(s_id)
{
	if($('ahrchd'+s_id)!=null)
		$('ahrchd'+s_id).className="on";
}



function ShowKefu()
{
	if($('tq_float_normal_container').style.display=="block")
	{
		$('tq_float_normal_container').style.display="none";
	}
	else
	{
		$('tq_float_normal_container').style.display="block";
	}	
	
	
}



/* good */
//移动
function MoveGoodInit()
{
	for(var i=0;i<2;i++)
	{
		
		var textDiv = document.getElementById("rollText"+i);
		var textList = textDiv.getElementsByTagName("LI");
		textDiv.style.cssText = "position:absolute; top:0px;font-size:12px;line-height:20px;width:3000px";
		
		//alert(textList.length);
		
		if(textList.length > 4)
		{
		 
		}
		else
		{
			//不能点击
			$('img'+i+'1').src="/template/images/jl0.gif";
			$('img'+i+'-1').src="/template/images/jr0.gif";
		}	
	}
}

var startgoodTop=new Array(0,0,0,0,0);
var newgoodLeft=new Array(0,0,0,0,0);
var rollgoodTime=new Array(0,0,0,0,0);
var i_maxwidth=144;

function ShowGoods(i_index,i_move)
{
	var i_moveHeight=i_move*i_maxwidth;
	
	
	if($('img'+i_index+''+i_move).src.search("1.gif")>0)
	{
		//可以点击
		 
		 startgoodTop[i_index]=newgoodLeft[i_index];
		 
		 newgoodLeft[i_index]+=i_moveHeight;
		 
		 
		 clearInterval(rollgoodTime[i_index]);
		 
		 rollgoodTime[i_index] = setInterval("StartMoveGood("+i_index+","+i_move+")",1);
		 
		 var i_max = document.getElementById("rollText"+i_index).getElementsByTagName("LI").length-1;
		 
		 //判断是否到底部了
		 if(newgoodLeft[i_index]==0)
		 {
		 	 $('img'+i_index+'1').src="/template/images/jl0.gif";
     }
     else if( (document.getElementById("rollAD"+i_index).offsetWidth+ Math.abs( newgoodLeft[i_index]))>(i_max*i_maxwidth))
     {
     		$('img'+i_index+'-1').src="/template/images/jr0.gif";		
     }
     else
     {
     	 if(i_move==1)
     	 {
     	 	 $('img'+i_index+'-1').src="/template/images/jr1.gif";		
     	 }
     	 else if(i_move==-1)
     	 {
     	 	 $('img'+i_index+'1').src="/template/images/jl1.gif";		
     	 }	
     }	
		 
		 
	}
}

function StartMoveGood(i_index,i_move)
{
	startgoodTop[i_index]+=i_move*12;
	
	$('rollText'+i_index).style.left=startgoodTop[i_index]+"px";	
	
	status=startgoodTop[i_index]+","+newgoodLeft[i_index]
	
	if(startgoodTop[i_index]==newgoodLeft[i_index])
	{
		clearInterval(rollgoodTime[i_index]);
	}
	
	
	
		
}

