var suboption = new Array();
var option = new Array();
var optionpics = new Array();
var upgrade_selects = new Array();
var last_suboption = new Array();


function popLargeWindow(prod_id)
{
	var newwin = window.open('/show_large.php?id='+prod_id, 'BigPic', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=740,height=560');
	newwin.focus();
}


function showLargeOption(option_id)
{
	var newwin = window.open('/show_large_option.php?option_id='+option_id, 'BigPic', 'screenX=20,screenY=20,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=350,height=450');
	newwin.focus();
}


function hasImage(id)
{
	for (var x=0;x<optionpics.length;x++) {
		if (optionpics[x] == id)
			return true;
	}

	return false;
}

// form must be called the_form ... otherwise you need to pass 'this' as well.
function clear_text(name)
{
	document.the_form[name].value = "";
	document.the_form['text_' + name].value = "";
}

function textCounter(field, countfield, maxlimit)
{

  //alert(field.value);

	if (field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);
	else {
		countfield.value = maxlimit - field.value.length;
	}
}

function toggleCompany(isOn, field)
{
	//alert(isOn);
	//alert(field);
  document.forms.theFrm[field].disabled = !isOn;
  if (!isOn)
  	document.forms.theFrm[field].value = "";
}

function changeTabNew(id)
{
	//stop auto rotation for 8 seconds, and start it over
	clearInterval(interval);
	clearTimeout(timeout);
	timeout = setTimeout('startTabRotation()', 8000)

	//change the tab
	for(i=1; i <= 6; i++)
	{
		if(id == i)
		{
			$('tab'+i).className="current";
			$('tab_link'+i).className="currentTab";
		}
		else
		{
			$('tab'+i).className="";
			$('tab_link'+i).className="";
		}
	}
}

function startTabRotation()
{
	interval = 0;
	timeout = 0;
	count = 1;
	clearInterval(interval);
	rotateTabs = true;
	//alert('timer started');
	interval = setInterval('tabRotationHandler(count)', 4000);



}

function tabRotationHandler(div_count)
{
	//change tab automatically
	//change the tab
	for(i=1; i <= 6; i++)
	{
		if(div_count == i)
		{
			$('tab'+i).className="current";
			$('tab_link'+i).className="currentTab";
		}
		else
		{
			$('tab'+i).className="";
			$('tab_link'+i).className="";
		}
	}
	if(count == 6)
	{
		count = 0;
	}
	count++;
	//alert(count);
}



