// JavaScript Document

function popUp(URL) {
	newwindow = window.open(URL, 'newwindow', 'toolbar=0, scrollbars=0, location=0, statusbar=0, menubar=0, resizable=0, width=415, height=308, left=200, top=175');
	if (window.focus) {
		newwindow.focus()
	} // if
} // popUp

function setDisplay(theElement, theStyle) {
//	alert("DOING IT");
//	alert(theElement + ', ' + theStyle);
	document.getElementById(theElement).style.display = theStyle;
} // setDisplay

function toggleVariations(theValue) {
	if (theValue == '0') {
		setDisplay('Price', 'block');
		setDisplay('Variations', 'none');
	} else {
		setDisplay('Price', 'none');
		setDisplay('Variations', 'block');
	}	// if
} // toggleVariations

function changeColour(id) {
  var colour = document.productdetail.colourSelector.options[document.productdetail.colourSelector.selectedIndex].value;
  if (colour != "X") {
//	  alert("colour: " + colour)
	  this.location = "productdetail.php?id="+id+"&colour=" + colour;
	}
} // changeColour

function addEvent(obj, evType, fn){
 if (obj.addEventListener){
    obj.addEventListener(evType, fn, true);
    return true;
 } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
 } else {
    return false;
 } // if
} // addEvent
