/*******************************************************************************
*                                                                              *
*  Web Site  :  http://www.focusart.com.au/                                         *
*  Author    :  EPS                                                    *
*  Modified  :  26-May-2006                                                   *
*                                                                              *
*******************************************************************************/
var d = document, dE = d.documentElement;
var fixIEwidth = 0;

/* Hover support for drop downs in IE (Opera 7.23 also seems to need this too?!)
*******************************************************************************/
function menuHover() {
	var menuItems = d.getElementById("nav").getElementsByTagName("LI");

	for (var i = 0, miL = menuItems.length; i < miL; i++) {
		menuItems[i].onmouseover = function() {
			this.className = "mnhover";
		}
		menuItems[i].onmouseout = function() {
			this.className = "";
		}

		// Add alpha transparencey in IE 5.5+
		var hasSub = menuItems[i].getElementsByTagName("UL")[0];
		if (hasSub && (typeof hasSub.filters == "object")) {
			//hasSub.style.filter = "alpha(opacity=90)";
		}
	}
}

/* Make external links pop
*******************************************************************************/
function popExLinks() {
	var aTags = d.getElementsByTagName("a");
	
	for( var i=0; i<aTags.length; i++ ) 
	{
		// all non-javascript/mailto href attributes pointing to external locations  or if it's a pdf document
		if( (aTags[i].href.indexOf("http://") == 0 && aTags[i].href.indexOf("http://"+d.domain) != 0) || (aTags[i].href.indexOf("https://") == 0 && aTags[i].href.indexOf("https://"+d.domain) != 0) || aTags[i].href.indexOf("http://") == 0 && aTags[i].href.indexOf(".pdf") > 5 || aTags[i].href.indexOf("http://") == 0 && aTags[i].href.indexOf(".html") > 5) 
		{
			aTags[i].target = "_blank";
		}
	}
}

/* Perform on page load/unload
*******************************************************************************/

function init() {
	window.defaultStatus = "Focusart";
}

window.onload = function(e) {
	// startList;
	if (d.all) {
		menuHover();
	}
	if (d.getElementById) {
		// Opera wont switch css sometimes unless we do it onload! POS!
		if (navigator.userAgent.indexOf('Opera') != -1) {
			init();
		}
	
		popExLinks();
	}
};
window.onunload = function(d) {
	if (d.getElementById) {
	}
};

if (d.all && !window.opera && fixIEwidth == 0) {
	
}


/* Perform as soon as we can!
*******************************************************************************/
init();

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/* Copy same values from one form to another
*******************************************************************************/
var check_flag = false;
function sameDetails() 
{
  if (check_flag == false) 
  {
    // Check box is selected, transfer values
    d.frmCheckout.shipFirst_Name.value = d.frmCheckout.billFirst_Name.value;
    d.frmCheckout.shipSurname.value = d.frmCheckout.billSurname.value;
		d.frmCheckout.shipAddress.value = d.frmCheckout.billAddress.value;
    d.frmCheckout.shipSuburb.value = d.frmCheckout.billSuburb.value;
		d.frmCheckout.shipState.value = d.frmCheckout.billState.value;
    d.frmCheckout.shipPostcode.value = d.frmCheckout.billPostcode.value;
    d.frmCheckout.shipEmail.value = d.frmCheckout.billEmail.value;
    d.frmCheckout.shipPhone.value = d.frmCheckout.billPhone.value;

	  // copy select box values(country values)
		currentSelect = d.frmCheckout.shipCountry.selectedIndex; 
		d.frmCheckout.shipCountry.options[currentSelect] = new Option(d.frmCheckout.billCountry.options[d.frmCheckout.billCountry.selectedIndex].text, d.frmCheckout.billCountry.options[d.frmCheckout.billCountry.selectedIndex].value); 
	  d.frmCheckout.shipCountry.selectedIndex = currentSelect;                  
    check_flag = true;
    return true;
	}
  else
  {
    // check box is de-selected, clear values
    d.frmCheckout.shipFirst_Name.value = "";                                              
	  d.frmCheckout.shipSurname.value = "";
	  d.frmCheckout.shipAddress.value = "";
	  d.frmCheckout.shipSuburb.value = "";
	  d.frmCheckout.shipPostcode.value = "";
	  d.frmCheckout.shipEmail.value = "";
	  d.frmCheckout.shipPhone.value = "";
    check_flag = false;
  }       
}

function disablePayment()
{
	if (d.frmPayment.payOptions[1].checked)
	{
		d.frmPayment.payCard_Name.disabled = false;
		d.frmPayment.payCard_Number.disabled = false;
		d.frmPayment.payCard_ExpireMonth.disabled = false;
		d.frmPayment.payCard_ExpireYear.disabled = false;
		
		//disable the card type buttons
		for (i=0;i<d.frmPayment.payCard_Type.length;i++)
		{
			d.frmPayment.payCard_Type[i].disabled = false;
		}
	}
	else
	{
		d.frmPayment.payCard_Name.disabled = true;
		d.frmPayment.payCard_Number.disabled = true;
		d.frmPayment.payCard_ExpireMonth.disabled = true;
		d.frmPayment.payCard_ExpireYear.disabled = true;
		
		//disable the card type buttons
		for (i=0;i<d.frmPayment.payCard_Type.length;i++)
		{
			d.frmPayment.payCard_Type[i].disabled = true;
		}
	}
}

function delItem(itemName)
{
	document.frmCart.del.value = itemName;
	return true;
}