var quantitychanged = 0;

function infopoppaywin(w,h,page)
{
wintype = "location=no,scrollbars=yes,status=yes,menubar=0,left=0,top=0,screenx=0,screeny=0,width="+w+",height="+h;
win=window.open(page,"newwin",wintype); 
win.focus();
}

function infopopscroll(w,h,page)
{
wintype = "location=no,scrollbars=yes,status=no,menubar=0,left=0,top=0,screenx=0,screeny=0,width="+w+",height="+h;
win=window.open(page,"newwin",wintype); 
win.focus();
}

function currencypop(currencypage)
{
win=window.open(currencypage,"currencywin","location=no,scrollbars=no,status=no,menubar=0,left=0,top=0,screenx=0,screeny=0,width=550,height=130"); 
win.focus();
}

function changeqty(refnumtodo,chgqty)
{
window.alert("QUANTITY CHANGE\n\nThe quantity of this item will be now changed");
window.document.location="t_checkorder.php?dowhat=QTY&refnum=" + refnumtodo + "&qty=" + chgqty + "";
}


function MM_displayStatusMsg(msgStr) 
{
status=msgStr;
document.MM_returnValue = true;
}

function validate_details()
{
//PICK UP CUSTOMER DETAILS
var title = window.document.forms.orderform.title.value;
var firstname = window.document.forms.orderform.firstname.value;
var lastname = window.document.forms.orderform.lastname.value;
var address1 = window.document.forms.orderform.address1.value;
var town = window.document.forms.orderform.town.value;
var telephone = window.document.forms.orderform.telephone.value;
var email = window.document.forms.orderform.email.value;
var postcode = window.document.forms.orderform.postcode.value;

//DO VALIDATIONS
if(title=="")
  { window.alert("ORDER ERROR\n\nYou have not entered your title.....");  }
else if(firstname=="")
  { window.alert("ORDER ERROR\n\nYou have not entered your first name.....");  }
else if(lastname=="")
  { window.alert("ORDER ERROR\n\nYou have not entered your last name.....");  }
else if(town=="")
  { window.alert("ORDER ERROR\n\nYou have not entered your city/town.....");  }
else if(email.indexOf("@") == -1)
  { window.alert("ORDER ERROR\n\nYou have not entered a valid e-mail address.....");  }
else if(email.indexOf(".") == -1)
  { window.alert("ORDER ERROR\n\nYou have not entered a valid e-mail address.....");  }
else if(telephone.length < 6)
  { window.alert("ORDER ERROR\n\nYou have not entered a valid telephone number.....");  }
else if(address1 == "")
  { window.alert("ORDER ERROR\n\nYou have not entered your postal address correctly.....");  }
else if(postcode == "")
  { window.alert("ORDER ERROR\n\nYou have not entered your postcode.....");  }  
else
  {
  window.document.orderform.submit();
  }

}

function dodiscount()
{
var discountcode = window.document.forms.itemsform.discountcode.value;
if(discountcode=="")
	{window.alert("DISCOUNT ERROR\n\nYou have not entered a discount code.....");}
else
	{window.document.location.href="control/H_discount_action.php?discountcode="+discountcode;}
}