
var onm = '';

function showmenu(m)
{
	var menu = document.getElementById("navmenu_" + m);
	menu.style.visibility = 'visible';

	var but = document.getElementById("navimg_" + m);
	but.src = "/images/nav/" + m + "_o.gif";
}


function hidemenu(m)
{
	var menu = document.getElementById("navmenu_" + m);
	menu.style.visibility = 'hidden';

	if (m != onm)
	{
		var but = document.getElementById("navimg_" + m);
		but.src = "/images/nav/" + m + ".gif";
	}
}

function setmenu(m)
{
	var but = document.getElementById("navimg_" + m);
	but.src = "/images/nav/" + m + "_o.gif";

	onm = m;
}


function hidediv(div_id)
{
	var divobj = document.getElementById(div_id);
	divobj.className = 'divh';
}

function showdiv(div_id)
{
	var divobj = document.getElementById(div_id);
	divobj.className = 'diva';
}


function AddToCart(prod_id,counter)
{
	ajax_loadContent("shoppingbag","/applets/showbag.php?lm=IGstorev2_basket&cf=AddtoBasket&p[NULL][qty]=1&p[NULL][prod_id]=" + prod_id);

	ajax_loadContent(counter+"notediv_" + prod_id,"/applets/showbag_add.php?prod_id=" + prod_id);
}

function AddToCartWedBuy(prod_id,counter,wid)
{

	ajax_loadContent("shoppingbag","/applets/showbag.php?lm=IGstorev2_basket&cf=AddtoBasket&p[NULL][qty]=1&p[NULL][prod_id]=" + prod_id+"&p[NULL][wedding]=yes"+"&p[NULL][IGwid]="+wid);

	ajax_loadContent(counter+"notediv_" + prod_id,"/applets/showbag_add.php?prod_id=" + prod_id);
}

function AddToWedding(prod_id,counter){

	ajax_loadContent(counter+"wednotediv_" + prod_id,"/applets/showbagwedding_add.php?prod_id=" + prod_id);
}


function RemoveFromRegistry(id,counter){
	if(confirm ("Are you sure you want to delete this item?")){
		ajax_loadContent(counter+"removenotediv_" + id,"/applets/removefromweddingregistry.php?id=" + id);
		document.getElementById(counter+"remove_whole_block_" + id).style.display = 'none';
	}
}


function addwedprods(wid,wuid,qty,delete_update){
	ajax_loadContent("content","/applets/wedding_registry_add.php?prod_id=" + wid + "&wuid=" + wuid + "&qty=" + qty+"&update=" +  delete_update);
}


function RemoveFromRegistry(id,counter){
	if(confirm ("Are you sure you want to delete this item?")){
		ajax_loadContent(counter+"removenotediv_" + id,"/applets/removefromweddingregistry.php?id=" + id);
		document.getElementById(counter+"remove_whole_block_" + id).style.display = 'none';
	}
}



function AddToCartMultiple(prod_id,prod_count)
{
	ajax_loadContent("shoppingbag","/applets/showbag.php?lm=IGstorev2_basket&cf=AddtoBasket&p[NULL][qty]="+prod_count+"&p[NULL][prod_id]=" + prod_id);
	ajax_loadContent("notediv_" + prod_id,"/applets/showbag_add.php?prod_id=" + prod_id);
}

function AddToCartX(prod_id)
{
	ajax_loadContent("shoppingbag","/applets/showbag.php?lm=IGstorev2_basket&cf=AddtoBasket&p[NULL][qty]=1&p[NULL][prod_id]=" + prod_id);
}


function refreshShoppingBag(username,password){

	ajax_loadContent("shoppingbag","/applets/showbag.php?template=shoppingbag&username="+username+"&password="+password);

}

function content_wedding_prods(page,limit,cid){
	ajax_loadContent('content',"/wedding/viewproducts_ajax.php?cid="+cid+"&limit="+limit+"&page="+page);
}

function content_wedding_prods_guest(page,limit,cid,id){
	ajax_loadContent('content',"/wedding/viewproducts_guest_ajax.php?cid="+cid+"&limit="+limit+"&page="+page+"&id="+id);
}

function fi_over(img)
{
	var x = document.getElementById('fi_' + img);
	x.src = '/images/footer/' + img + "_o.gif";
}

function fi_off(img)
{
	var x = document.getElementById('fi_' + img);
	x.src = '/images/footer/' + img + ".gif";
}


function popWindow(wName,field)
{

	if(field == ''){
		alert('Please enter an Email address to subscribe');
		return false;
	}else{
		if(echeck(field) == false){
			return false;
		}
	}


	features = 'width=540,height=250,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no';
	pop = window.open('','popupwindow',features);
	if(pop.focus){ pop.focus(); }
	return true;
}

function popWindowBank()
{

	features = 'width=540,height=160,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no';
	pop = window.open('/bankingdetails/','popupwindow',features);
	if(pop.focus){ pop.focus(); }
	return true;
}

/*This function can be called to validate email addresses*/
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail address")
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail address")
		    return false
		 }

 		 return true
	}

function validateAcceptedNewsLetter() {
	//alert(document.getElementById('AcceptNewsletter').checked);
	if(!document.getElementById('AcceptNewsletter').checked){
		alert("Please select the checkbox");
	} else {
		if (popWindow(this.target,document.oemProSubscription.FormValue_Email.value)){
			document.oemProSubscription.submit();
		}
	}
}


function changeValues() {

  document.reg_form.IGstorev2_order_X_shipto_firstname.value =  document.reg_form.IGstorev2_order_X_billto_firstname.value;
    document.reg_form.IGstorev2_order_X_shipto_lastname.value =  document.reg_form.IGstorev2_order_X_billto_lastname.value;
   document.reg_form.IGstorev2_order_X_shipto_address.value =  document.reg_form.IGstorev2_order_X_billto_address.value;
   document.reg_form.IGstorev2_order_X_shipto_suburb.value =  document.reg_form.IGstorev2_order_X_billto_suburb.value;
    document.reg_form.IGstorev2_order_X_shipto_city.value =  document.reg_form.IGstorev2_order_X_billto_city.value;

	 document.reg_form.IGstorev2_order_X_shipto_province.selectedIndex =  document.reg_form.IGstorev2_order_X_billto_province.selectedIndex;
	     document.reg_form.IGstorev2_order_X_shipto_postal.value =  document.reg_form.IGstorev2_order_X_billto_postal.value;
		  //document.reg_form.IGstorev2_order_X_shipto_country.selectedIndex =  document.reg_form.IGstorev2_order_X_billto_country.selectedIndex;
     document.reg_form.IGstorev2_order_X_shipto_tel.value =  document.reg_form.IGstorev2_order_X_billto_tel.value;
	 document.reg_form.IGstorev2_order_X_shipto_fax.value =  document.reg_form.IGstorev2_order_X_billto_fax.value;
	 document.reg_form.IGstorev2_order_X_shipto_cell.value =  document.reg_form.IGstorev2_order_X_billto_cell.value;

}


<!--
  if(window.attachEvent)
    window.attachEvent("onload",setListeners);

  function setListeners(){
    inputList = document.getElementsByTagName("INPUT");
    for(i=0;i<inputList.length;i++){
      inputList[i].attachEvent("onpropertychange",restoreStyles);
      inputList[i].style.backgroundColor = "";
    }
    selectList = document.getElementsByTagName("SELECT");
    for(i=0;i<selectList.length;i++){
      selectList[i].attachEvent("onpropertychange",restoreStyles);
      selectList[i].style.backgroundColor = "";
    }
  }

  function restoreStyles(){
    if(event.srcElement.style.backgroundColor != "")
      event.srcElement.style.backgroundColor = "";
  }//-->



//-->