// function.js


function OpenPopup (c) {
window.open(c,'window',
'width=480,height=480,scrollbars=no,status=no');
}


function bigpic(pic)

{
	
	var img = document.getElementById(pic)
	
	img.style.height = '300px';
    img.style.width = '300px';
	img.style.position = 'absolute';
	
	
}

function smallpic(pic)

{
	
	var img = document.getElementById(pic)
	
	img.style.height = '170px';
    img.style.width = '170px';
	img.style.position = 'static';
	
}



function goto(form) { var index=form.select.selectedIndex
if (form.select.options[index].value != "0") {
location=form.select.options[index].value;}}




function check_digit(i) {
	
	var a=0;
	for (a=0;a<i;a++) {

var themessage = "You are required to complete the following fields: \n\n";

var cd= /^^[-]?\d*\.?\d*$/; 
if (document.getElementById(a).value.search(cd)==-1) {
themessage = themessage + " -  Quantity Numeric Only\n";
}

if (themessage == "You are required to complete the following fields: \n\n") {
document.cart.submit();
}

else {
alert(themessage);
return false;
   }}}
   
   
   
 function verify() {
	 
   var themessage = "Please complete the following fields: \n\n";
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.newform.email.value;
  

	if(document.newform.email.value =="" || reg.test(address) == false) {
	themessage = themessage + " -  Invalid Email\n";
	}
	

  	 if (document.newform.passwd.value.length < 6 ||  document.newform.passwd.value.length > 16) {
   themessage = themessage + " -  Invalid Password\n";
   
	}
	 
	if (document.newform.passwd.value != document.newform.passwd2.value) {
	themessage = themessage + " -  Password Not Matched\n";
	}
	 
	 if (themessage == "Please complete the following fields: \n\n") {
		document.newform.submit();
	}

	else {
		alert(themessage);
		return false;
	}
 }
 


 function verifycheckout() {
	 
   var themessage = "Please complete the following fields: \n\n";

	 
	if (document.checkoutform.first_name.value == "") {
	themessage = themessage + " -  First Name\n";
	}
	
		if (document.checkoutform.last_name.value == "") {
	themessage = themessage + " -  Last Name\n";
	}
	
		if (document.checkoutform.cus_add1.value == "") {
	themessage = themessage + " -  Address\n";
	}
	
		if (document.checkoutform.country.value == "Select A Country") {
	themessage = themessage + " -  Country\n";
	}
	
		chosen = "";
		len = document.checkoutform.selpayment.length;

	for (i=0;i<len;i++) {

	if (document.checkoutform.selpayment[i].checked)
	{ chosen = document.checkoutform.selpayment[i].value;}
	
	} 
	
	if (chosen =="") {
		themessage = themessage + " -  Payment Method\n";
	
	}
	 if (themessage == "Please complete the following fields: \n\n") {
		document.checkoutform.submit();
	}

	else {
		alert(themessage);
		return false;
	}
 }
 
  
 
 function orderdetail(a) { 

// Flip the visibility adjective to whatever it is not now 

 if (document.getElementById(a).style.display == "none")
   document.getElementById(a).style.display = "";
 else
   document.getElementById(a).style.display = "none";
}

