function setColour(thispage, catId, prodId, pos, colId, viewId)
  {
  var cid=document.getElementById("selColour");
  if (cid) 
  {
    var cidx=cid.options[cid.selectedIndex].value;
  }
  else
  {
    var cidx=colId;
  }  
  var sid=document.getElementById("selSize");
  var sidx=sid.selectedIndex;
  temp=thispage+"?c="+catId+"&p="+prodId+"&col="+cidx+"&sz="+sid.options[sidx].value+"&pos="+pos;
  window.location.href=temp;

//  location='muletTShirtDetail.php?p='+pid.value+'&col='+cid.options[cidx].value+'&sz='+sid.options[sidx].value;
  }
/*
Input : a string
*/
function trim(str)
{
	return str.replace(/^\s+|\s+$/g,'');
}

/*
Make sure that textBox only contain number
*/
function checkNumber(textBox)
{
	while (textBox.value.length > 0 && isNaN(textBox.value)) {
		textBox.value = textBox.value.substring(0, textBox.value.length - 1)
	}
	
	textBox.value = trim(textBox.value);
/*	if (textBox.value.length == 0) {
		textBox.value = 0;		
	} else {
		textBox.value = parseInt(textBox.value);
	}*/
}

/*
	Check if a form element is empty.
	If it is display an alert box and focus
	on the element
*/
function isEmpty(formElement, message) {
	formElement.value = trim(formElement.value);
	
	_isEmpty = false;
	if (formElement.value == '') {
		_isEmpty = true;
		alert(message);
		formElement.focus();
	}
	
	return _isEmpty;
}

/*
	Set one value in combo box as the selected value
*/
function setSelect(listElement, listValue)
{
	for (i=0; i < listElement.options.length; i++) {
		if (listElement.options[i].value == listValue)	{
			listElement.selectedIndex = i;
		}
	}	
}

function Over(element)
{
    document.getElementById(element).style.width="200px";
}
function NotOver(element)
{
    document.getElementById(element).style.width="150px";
}

function PgOver(element)
{
    document.getElementById(element).style.color="#FFFFC0";
}
function PgNotOver(element)
{
    document.getElementById(element).style.color="yellow";
}
