<!--

function gotoURL(what)
{
	switch(what)
	{
		case "sub":
		var lmnt = document.sub_cat.select_sub_cat[document.sub_cat.select_sub_cat.selectedIndex].value;
		break;
		
		case "desc":
		var lmnt = document.desc_cat.select_desc_cat[document.desc_cat.select_desc_cat.selectedIndex].value;
		break;
		
		case "edit":
		var lmnt = document.frm_prod.prod_id[document.frm_prod.prod_id.selectedIndex].value;
		break;
	}
	
	if(lmnt != "")
	{
		window.location = lmnt;
	}
}

//Author: Krasimir Makaveev | kmakaveev@yahoo.com | 2003
//
//This script opens a new blank window in the center of the screen. First we must solve really important problem...
//
//For NN the position of the browser's window on the screen depends on "screenX" and "screenY" attributes.
//For IE the position of the browser's window on the screen depends on "top" and "left" attributes.
//Using a "browser-detection"-like function, we first detect the browser and then open the window with the appropriate for the browser attributes.
//So...

function winOpen(winname,w,h)
{
	var sw = screen.width;
	var sh = screen.height;
	
	//Simple mathematical transformations
	var sh_off = (sw - w)/2;
	var sw_off = (sh - h)/2;
	
	if(navigator.appName.indexOf("MSIE"))
	{
		ext_win = window.open("",winname,"toolbar=no,copyhistory=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=no,top="+sw_off+",left="+sh_off+",width="+w+",height="+h+"");
		ext_win.focus();
	}
	else
	{
		ext_win = window.open("",winname,"toolbar=no,copyhistory=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=no,screenX="+sw_off+",screenY="+sh_off+",width="+w+",height="+h+"");
		ext_win.focus();
	}
}

function show_sel_feat_prod()
{
	var s_feat_prod = "";
	
	var cnt = 0;
	
	var max = document.frm_prod.prod_id.length;
	
	for (var idx = 0; idx < max; idx++)
	{
		if (eval("document.frm_prod.prod_id[" + idx + "].selected") == true)
		{
			 s_feat_prod =  s_feat_prod + "<li>" + document.frm_prod.prod_id[idx].text + "</li>";
			 cnt++;
   		}
	}
	
	if(cnt > 4)
	{
		cnt = 4;
	}
	
	document.getElementById('sel_feat_prod').innerHTML = "<ul>" + s_feat_prod + "</ul><strong>" + (4 - cnt) + "</strong> products remaining";
}

function reset_values()
{
	document.search_form_cont.page.value = "";
}

function dbg()
{
	alert(document.add2cart.p_price.value);
}

// Checks if the selected sizes is in the array

function is_in_arr(arr,val)
{
	var l = arr.length;
	
	var res = "";
	
	for (var i = 0; i < l; i++)
	{
		if(arr[i] == val)
		{
			res = true;
		}
	}
	
	return res;
}

// Checks if the selected sizes has $0.00 price

function check_zero(val)
{
	if(val != "0.00")
	{
		res = true;
	}
	else
	{
		res = false;
	}
	
	return res;
}

// Fetch the index of the price element

function arr_idx(arr,val)
{
	var l = arr.length;
	
	var res = 0;
	
	for (var i = 0; i < l; i++)
	{
		if(arr[i] == val)
		{
			res = i;
		}
	}
	
	return res;
}

// validate form
function form_validator(theForm)
{
	var qty = parseInt(document.add2cart.quantity.value);
	var min_qty = parseInt(document.add2cart.p_min_qty.value);
	
	if(qty < min_qty)
	{
		alert("You have to order at least " + min_qty + " pieces of this product.");
		document.add2cart.quantity.focus();
		document.add2cart.quantity.value = min_qty;
		return (false);
	}
	
	if(document.add2cart.custom4 && (document.add2cart.custom4[document.add2cart.custom4.selectedIndex].value == ""))
	{
		alert("You have to select a custom logo.");
		return (false);
	}
	
	if(document.add2cart.custom2 && (document.add2cart.custom2[document.add2cart.custom2.selectedIndex].value == ""))
	{
		alert("You have to select a color.");
		return (false);
	}
	
	if(document.add2cart.custom3 && (document.add2cart.custom3[document.add2cart.custom3.selectedIndex].value == ""))
	{
		alert("You have to select a size.");
		return (false);
	}
	
	return (true);
}

//-->