// JavaScript Document

//打开固定新窗口
var open_winobj;
function open_newwindow(url_var,win_name,winwidth,winheight)
{
	var win_width=screen.width;
	if(!winwidth)
	{
		win_width=winwidth;
	}
	var win_height=screen.height;
	if(!winheight)
	{
		win_height=winheight;
	}	
	if (open_winobj)
	{
		open_winobj.close();
		open_winobj=null;
		open_winobj=window.open(url_var,win_name,"width=" + win_width + ",height=" + win_height + ",top=0,left=0,scrollbars=1, resizable=yes");
	}
	else
	{
		open_winobj=window.open(url_var,win_name,"width=" + win_width + ",height=" + win_height + ",top=0,left=0,scrollbars=1, resizable=yes");
	}
}

//打开新窗口
function open_newwin(url_var,win_name,winwidth,winheight)
{
	var win_width=screen.width;
	if(!winwidth)
	{
		win_width=winwidth;
	}
	var win_height=screen.height;
	if(!winheight)
	{
		win_height=winheight;
	}	
	window.open(url_var,win_name,"width=" + win_width + ",height=" + win_height + ",top=0,left=0,toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, status=no");
}

//打开新窗口
function opencart_newSL(url_var,win_name)
{
	var win_width=300;
	var win_height=120;
	var win_left=screen.width/2;
	var win_top=screen.height/2;
	if(win_left>win_width/2)
	{
		win_left=win_left-(win_width/2);
	}
	if(win_top>win_height/2)
	{
		win_top=win_top-(win_height/2);
	}	
	window.open(url_var,win_name,"width=" + win_width + ",height=" + win_height + ",top=" + win_top + ",left=" + win_left + ",toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, status=no");
}

//对象滚动函数
function startmarquee(lh,speed,delay,index){
	//参数(lh)表示移动对象的显示高度
	//参数(speed)表示移动速度
	//参数(delay)表示处理移动延迟时间
	//参数(index)表示处理移动的DIV标识ID参数
	var t;
	var p=false;
	var o=document.getElementById("marqueebox"+index);
	o.innerHTML+=o.innerHTML;
	o.onmouseover=function(){p=true}
	o.onmouseout=function(){p=false}
	o.scrollTop = 0;
	function start(){
		t=setInterval(scrolling,speed);
		if(!p) o.scrollTop += 2;
	}
	function scrolling(){
		if(o.scrollTop%lh!=0){
			o.scrollTop += 2;
			if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0;
		}else{
			clearInterval(t);
			setTimeout(start,delay);
		}
	}
	setTimeout(start,delay);
}