var browser_name = navigator.appName;



/*
Author: Michele Damico
Company: 5150 Productions
Email: mdamico@5150-productions.com
Date: 08/03/2006 
Description: Open New Window
*/
var win=null;
function NewWindow(mypage,myname,w,h,pos,infocus){
	if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
	settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes";
	win=window.open(mypage,myname,settings);
	win.focus();
}


/*
Author: Michele Damico
Company: 5150 Productions
Email: mdamico@5150-productions.com
Date: 08/03/2006 
Description: Hop Fields
*/ 
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode;
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}



/*
Author: Michele
Date: 08/03/2006  
Description: Image rollovers
*/
if (document.images) {
	var emboff = new Image();
   	emboff.src = "/images/teakoff.gif";
        var emb1off = new Image();
        emb1off.src = "/images/coversoff.gif";
        var emb2off = new Image();
        emb2off.src = "/images/featuresoff.gif";
        var emb3off = new Image();
        emb3off.src = "/images/customoff.gif";
        var emb4off = new Image();
        emb4off.src = "/images/retailersoff.gif";
        var emb5off = new Image();
        emb5off.src = "/images/customeroff.gif";

	var embon = new Image();
   	embon.src = "/images/teakover.gif";
        var emb1on = new Image();
        emb1on.src = "/images/coversover.gif";
        var emb2on = new Image();
        emb2on.src = "/images/featuresover.gif";
        var emb3on = new Image();
        emb3on.src = "/images/customover.gif";
        var emb4on = new Image();
        emb4on.src = "/images/retailersover.gif";
        var emb5on = new Image();
        emb5on.src = "/images/customerover.gif";

}

function img_act(imgName) {
if (document.images) {
       	document.images[imgName].src = eval(imgName + "on.src");
}
}
    
function img_inact(imgName) {
if (document.images) {
        document.images[imgName].src = eval(imgName + "off.src");
}
}



/*
Author: Michele
Date: 08/03/2006 
Description: change page for cats
*/
var colorSet;
function changePrice(number) {
	priceplus = eval("document.FORM.price"+number+".value");
	dimsplus = eval("document.FORM.dims"+number+".value");
	document.FORM.price.value = "$" + priceplus;
	document.FORM.dimensions.value = dimsplus;
	//document.FORM.code.value = document.FORM.Product_Code.value;
	document.FORM.Product_Code.value = document.FORM.code.value;
	if (colorSet == "Coffee") {
		changeFabric('Coffee');
	}
}

function changeFabric(color) {
	colorSet=color;
	code = document.FORM.Product_Code.value;
	shortCode = code.substring(code.length - 4); 
	if (color == "Coffee") {
		newCode = "3" + shortCode;
		
	} else {
		newCode = "2" +shortCode;
	}
	//document.FORM.code.value = newCode;
	document.FORM.Product_Code.value = newCode;

}


/*
Author: Michele
Date: 08/03/2006 
Description: Teak Show
*/
function teakchange(type) {
 if (type == "GT101C") {
 		elem = document.getElementById("cleanerimg");
  		elem.style.display = "block";
 		elem = document.getElementById("protectorimg");
  		elem.style.display = "none";
   		elem = document.getElementById("patinizerimg");
  		elem.style.display = "none";		
 		elem = document.getElementById("cleaner");
  		elem.style.display = "block";
 		elem = document.getElementById("protector");
  		elem.style.display = "none";
   		elem = document.getElementById("patinizer");
  		elem.style.display = "none";		
   	} else if (type == "GT102C") {
 		elem = document.getElementById("cleanerimg");
  		elem.style.display = "none";
 		elem = document.getElementById("protectorimg");
  		elem.style.display = "block";
   		elem = document.getElementById("patinizerimg");
  		elem.style.display = "none";		
 		elem = document.getElementById("cleaner");
  		elem.style.display = "none";
 		elem = document.getElementById("protector");
  		elem.style.display = "block";
   		elem = document.getElementById("patinizer");
  		elem.style.display = "none";		
   	} else if (type == "GT104C") {
 		elem = document.getElementById("cleanerimg");
  		elem.style.display = "none";
 		elem = document.getElementById("protectorimg");
  		elem.style.display = "none";
   		elem = document.getElementById("patinizerimg");
  		elem.style.display = "block";		
 		elem = document.getElementById("cleaner");
  		elem.style.display = "none";
 		elem = document.getElementById("protector");
  		elem.style.display = "none";
   		elem = document.getElementById("patinizer");
  		elem.style.display = "block";		
   	}

 }
 
 
 /*
 Author: Michele
 Date: 08/19/2006 
 Description: Price Calc Show
*/
function showDiv(layer) {
	elem = document.getElementById(layer);
	elem.style.display = "block";
}
function hideDiv(layer) {
	elem = document.getElementById(layer);
	elem.style.display = "none";
}
function hideAllDiv() {
	elem = document.getElementById('chair');
	elem.style.display = "none";
	elem = document.getElementById('table');
	elem.style.display = "none";
	elem = document.getElementById('grill');
	elem.style.display = "none";
}


/*
Author: Michele
Date: 8/19/06 
Description: change page for cats
*/
function changePage(val1,val2) {
	if (val1 == "round") {
		if (val2 == "yes") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_TABCH_ROUNDH";
		} else {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_TABCH_ROUND";
		}
	} else if (val1 == "oval") {
		if (val2 == "yes") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_TABCH_OVALH";
		} else {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_TABCH_OVAL";
		}
		
	}
}


/*
Author: Michele
Date: 8/19/06 
Description: change page for cats
*/
function changeCategoryPage(val1) {
	if (val1 == "otto") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_TABLE_OTTO";
	} else if (val1 == "round") {

		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_TABLE_ROUND";
	} else if (val1 == "sale_chairs") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_SALE_CHAIR";
	
	} else if (val1 == "sale_tablechair") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_SALE_TABCH";
	
	} else if (val1 == "sale_table") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_SALE_TABLE";
	
	} else if (val1 == "sale_chaise") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_SALE_CHAISE";
	
	} else if (val1 == "sale_grill") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_SALE_GRILL";
	
	} else if (val1 == "sale_other") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_SALE_OTHER";
	
	} else if (val1 == "sale_moto") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_SALE_MOTO";
		
	} else if (val1 == "misc_umb") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_MISC_UMBR";

	} else if (val1 == "misc_cush") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_MISC_CUSH";

	} else if (val1 == "misc_bike") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_MISC_BIKE";

	} else if (val1 == "misc_cart") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_MISC_CART";

	} else if (val1 == "grill_kettle") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_GRILL_KETT";

	} else if (val1 == "grill_pedestal") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_GRILL_PEDE";

	} else if (val1 == "grill_2shelf") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_GRILL_2SHELF";

	} else if (val1 == "grill_large") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_GRILL_LARGE";

	} else if (val1 == "chair_chair") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_CHAIR_CHAIR";

	} else if (val1 == "chair_garden") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_CHAIR_BENCH";
	} else if (val1 == "chair_chaise") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_CHAIR_CHAISE";
	} else if (val1 == "chair_loveseat") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_CHAIR_LSEAT";
	} else if (val1 == "chair_wchair") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_CHAIR_WCHAIR";
	} else if (val1 == "chair_wchaise") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_CHAIR_WCHAISE";
	} else if (val1 == "chair_wlounge") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_CHAIR_WLOUNGE";
	} else if (val1 == "chair_wloveseat") {
		window.location.href = "http://store.koverroos.com/mm5/merchant.mvc?Screen=CTGY&Store_Code=K&Category_Code=C_CHAIR_WLSEAT";
	}
}



/*
Author: Michele
Date: 8/19/06 
Description: change page for prods
*/
function changeProductPage(val1) {
	window.location.href = eval('http://store.koverroos.com/mm5/merchant.mvc?Screen=PROD&Store_Code=K&Product_Code=' + val1);
}

/*
Author: Michele
Date: 12/08/06 
Description: change page for custom area
*/
function changeCustomProductPage(val1) {
	newURL = "http://store.koverroos.com/mm5/merchant.mvc?Screen=PROD&Store_Code=K&Category_Code=C_CUST&Product_Code=" + val1;
	window.location.href = newURL;
}
