/* This little bit of java script handles the scrolling
of the main content elements inside their
container clipping div's */
var movement=4;  //pixels
var freq=25; //mili seconds
var scrollObj;
var containerObj;

function moveDown(){
    if (parseInt(scrollObj.style.top)>(scrollObj.offsetHeight-containerObj.offsetHeight)*-1){
        scrollObj.style.top=(parseInt(scrollObj.style.top)-movement)+"px";
    } 
    moveDownVar=setTimeout("moveDown()",freq);
}

function moveUp(){ 

    if (parseInt(scrollObj.style.top)<0){ 
        scrollObj.style.top=(parseInt(scrollObj.style.top)+movement)+"px";
    }
    moveUpVar=setTimeout("moveUp()",freq); 
}

function moveLeft(){
    if (parseInt(scrollObj.style.left)>(scrollObj.offsetWidth-containerObj.offsetWidth)*-1){
        scrollObj.style.left=(parseInt(scrollObj.style.left)-movement)+"px";
    } 
    moveLeftVar=setTimeout("moveLeft()",freq);
}

function moveRight(){ 
    if (parseInt(scrollObj.style.left)<0){ 
        scrollObj.style.left=(parseInt(scrollObj.style.left)+movement)+"px"; 
    }
    moveLeftVar=setTimeout("moveRight()",freq); 
}

function setClothesLineWidth(){
	var clothes_line = document.getElementById("clothes_line");

	//add up the widths of the images inside the clothes line
	var images=clothes_line.getElementsByTagName('img');
	var i=0;
	var width = 0;
	for(i=0; i < images.length; i++){
		width = width+images[i].width+4;
	}
	if(width < 300) width = 300;
	
	//set the width to this
	var clothes_line = document.getElementById("clothes_line");
	clothes_line.style.width = width+"px";

}


function setUp_A(){
	scrollObj=document.getElementById("clothes_line");
	containerObj=document.getElementById("clothes_line_container");
	setClothesLineWidth();
	setUp();
}

function setUp_B(){
	scrollObj=document.getElementById("general_text");
	containerObj=document.getElementById("general_text_container");
	setUp();
}
function setUp_C(){
	scrollObj=document.getElementById("productbox");
	containerObj=document.getElementById("productbox_container");
	setUp();
}

function setUp(){
	//resizeTo(840,850);
}