// JavaScript Document

function shiftProducts(direction,isInside) {
	var maxProductsShown = 3;
	if (isInside) {
		maxProductsShown = 4;
	}
	
	
	var products = document.getElementById("productsList").getElementsByTagName("a");
	var numProducts = products.length;
	
	for (var i = 0; i < numProducts; i++) {
		var product = products[i];
		
		if (product.className == "product firstProduct") {
			var firstProduct = i;
		}
	}
	
	if (direction == 0) {
		// Hide currently visible products
		for (var i = 0; i < maxProductsShown; i++) {
			var nextProduct = firstProduct + i;
			if (nextProduct < numProducts) {
				products[firstProduct + i].className = "product";
				products[firstProduct + i].style.display = "none";
			}
		}
		
		document.getElementById("loading").style.display = "block";
		setTimeout(function() {
			document.getElementById("loading").style.display = "none";
							
			// Shoe previous 3 products
			for (var i = 1; i <= maxProductsShown; i++) {
				var nextProduct = firstProduct - i;
				
				if (nextProduct >= 0) {
					if (i == maxProductsShown) {
						products[nextProduct].className = "product firstProduct";
						products[nextProduct].style.display = "block";
					} else {
						products[nextProduct].className = "product";
						products[nextProduct].style.display = "block";
					}
				} else {
					break;
				}
			}
		}, 1000);
	} else {
		// Hide currently visible products
		for (var i = 0; i < maxProductsShown; i++) {
			var nextProduct = firstProduct + i;
			
			if (nextProduct < numProducts) {
				products[nextProduct].className = "product";
				products[nextProduct].style.display = "none";
			} else {
				break;
			}
		}
		
		document.getElementById("loading").style.display = "block";
		setTimeout(function() {
			document.getElementById("loading").style.display = "none";
							
			// Show next 3 products
			for (var i = maxProductsShown; i < (maxProductsShown*2); i++) {
				var nextProduct = firstProduct + i;
				
				if (nextProduct < numProducts) {
					if (i == maxProductsShown) {
						products[nextProduct].className = "product firstProduct";
					} else {
						products[nextProduct].className = "product";
					}
					products[nextProduct].style.display = "block";
				} else {
					break;
				}
			}
		}, 1000);
	}
}

function toggleBox(szDivID, iState) { // 1 visible, 0 hidden
	if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
       // obj.style.visibility = iState ? "visible" : "hidden";
		obj.style.display= iState ? "" : "none"; 
        //obj.style.zIndex=0
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}
function changeIFrame(videoName){
	//window.alert(videoName);
	new Effect.Appear('Overlay', {duration: 0});new Effect.BlindDown('Popup1', {duration: .5});
	document.getElementById("VideoPlay").src="/Signa/VideoPlay.asp?Video="+videoName; 
	}
	
function closeIFrame(){
	new Effect.Fade('Overlay', {duration: 0});new Effect.BlindUp('Popup1', {duration: 0});
	document.getElementById("VideoPlay").src="/Signa/VideoPlay.asp"; 
	}
	
	