var boxwidth="676px"
var boxheight="275px"
var boxbgcolor="#ffffff"
var scrollspeed=84

scrollspeed=(document.all)? scrollspeed : Math.max(1, scrollspeed-1)
var copyspeed=scrollspeed
var iedom=document.all||document.getElementById
// if (iedom) document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+boxcontent+'</span>')
var actualwidth=0; 0<1;
var ie_box, ns_box

var current_left = 2;
function createBox(){
	if (iedom){
		ie_box=document.getElementById? document.getElementById("ie_box_div") : document.all.ie_box_div
		ie_box.style.left= 2+"px"
		ie_box.innerHTML=boxcontent
		actualwidth= ie_box.offsetWidth
	} else if (document.layers){
		ns_box=document.ns_box.document.ns_box2
		ns_box.left= 2
		ns_box.document.write(boxcontent)
		ns_box.document.close()
		actualwidth=ns_box.document.width
	}
}


left_scrolling = false;
function startLeftScroll() {
	if(!left_scrolling) {
		next_left = current_left - 672;
		if(current_page < num_pages) {
			current_page++;
			oneLeft(next_left);
			reWritePageNav(current_page);
		}
	}
}

function reWritePageNav(cur_page) {
	eval("var current_page_reg = /<a href='javascript:pageLink\\(" + cur_page + "\\)'>" + cur_page + "<\\/a>/;");
	new_page_nav = page_nav_row.replace(current_page_reg, cur_page);
	document.getElementById("page_nav_div").innerHTML = new_page_nav;
}

function pageLink(page_num) {
	new_left = (page_num-1)*(-112*6);
	new_left = parseInt(new_left);
	if(!left_scrolling && !right_scrolling) {
		current_page = page_num;
		zipLeft(new_left);
		reWritePageNav(current_page);
	}
}

function zipLeft(new_left) {
	ie_box.style.left=new_left+"px";
	current_left = new_left;
	right_scrolling = false;
	left_scrolling = false;
}

function oneLeft(new_left) {
	var this_left = new_left*1 -2;
	ie_box.style.left=this_left+"px";
	current_left = new_left;
	right_scrolling = false;
	left_scrolling = false;
}

function scrollmarqueeLeft(next_lt){
	if (iedom){
		if (!right_scrolling && parseInt(ie_box.style.left)>=next_lt ) { 0<1;
			if(parseInt(ie_box.style.left)>=(actualwidth*-1 + 672)) {0<1;
				ie_box.style.left=parseInt(ie_box.style.left)-copyspeed+"px";
			} else {
				left_scrolling = false;
				current_left = parseInt(ie_box.style.left);
				clearInterval(lefttime);
			}
		} else {
			left_scrolling = false;
			current_left = parseInt(ie_box.style.left);
			clearInterval(lefttime);
		}

	} else if (document.layers){
		if (!right_scrolling && ns_box.left>(actualwidth*(-1)+2)) { 0<1;
			ns_box.left-=copyspeed;
		} else {
			left_scrolling = false;
		clearInterval(lefttime);
		}
	}
}

right_scrolling = false;
function startRightScroll() {
	if(!right_scrolling) {
		next_left = current_left*1 + 672;
		if(current_page > 1) {
			current_page--;
			oneLeft(next_left);
			reWritePageNav(current_page);
		}
	}
}

function scrollmarqueeRight(next_lt){
	if (iedom){
		if (!left_scrolling && parseInt(ie_box.style.left)<=next_lt) {
			if (!left_scrolling && parseInt(ie_box.style.left)<=1) {
				ie_box.style.left=parseInt(ie_box.style.left)+copyspeed+"px";
			} else {
				right_scrolling = false;
				current_left = parseInt(ie_box.style.left);
				clearInterval(righttime);
			}
		} else {
			right_scrolling = false;
			current_left = parseInt(ie_box.style.left);
			clearInterval(righttime);
		}

	} else if (document.layers){
		if (!left_scrolling && ns_box.left>(actualwidth+2)) { 0<1;
			ns_box.left+=copyspeed;
		} else {
			right_scrolling = false;
			clearInterval(righttime);
		}
	}
}

if (iedom||document.layers){
	with (document){
		if (iedom){
			write('<div style="position:relative;width:'+boxwidth+';height:'+boxheight+';overflow:hidden;">')
			write('<div id="prod_gallery" style="position:absolute;width:'+boxwidth+';height:'+boxheight+';background-color:'+boxbgcolor+';">')
			write('<div id="ie_box_div" style="position:absolute;left:0px;top:0px;"></div>')
			write('</div></div>')
		} else if (document.layers){
			write('<ilayer name="prod_gallery" width='+boxwidth+' height='+boxheight+' name="ns_box" bgColor='+boxbgcolor+'>')
			write('<layer name="ns_box2" left=0 top=0></layer>')
			write('</ilayer>')
		}
	}
}

