/* Validate Number */
function validate(field) {
var valid = "0123456789"
var ok = "yes";
var temp;
	for (var i=0; i<field.value.length; i++) {
	temp = "" + field.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok = "no";
	}
	if (ok == "no") {
	alert("Invalid entry! Only numbers are accepted as the quantity");
	field.focus();
	field.select();
	   }
}

/* Empty Shopping Cart */
function empty() {
var check = confirm('Are you sure you want to empty your shopping cart?');
	if (check == true) {
		window.location.href = 'admin/order/cart.php?deletecookie=yes';
	}
}

/* Copy Contact Details */
function copyContactDetails() {
  document.contactinfo.shipping_fname.value = document.contactinfo.contact_fname.value;
  document.contactinfo.shipping_lname.value = document.contactinfo.contact_lname.value;
  document.contactinfo.shipping_company.value = document.contactinfo.contact_company.value;
  document.contactinfo.shipping_address.value = document.contactinfo.contact_address.value;
  document.contactinfo.shipping_city.value = document.contactinfo.contact_city.value;
  document.contactinfo.shipping_state.value = document.contactinfo.contact_state.value;
  document.contactinfo.shipping_postcode.value = document.contactinfo.contact_postcode.value;
  document.contactinfo.shipping_country.value = document.contactinfo.contact_country.value;
  document.contactinfo.shipping_phone.value = document.contactinfo.contact_phone.value;
}


/* PopUp Window */
function popUp(URL,h,w) {
  day = new Date();
  id  = day.getTime();
  eval("page" + id + " = window.open(URL, '" + id + "', 'top=0,left=0,height=" + h + ",width=" + w + ",resizable=yes,scrollbars=yes,toolbars=no');");
}


/* Image Reswap */
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


var imgOne = 1;
var imgTwo = 2;
var imgThree = 3;
var imgFour = 4;
var imgFive = 5;
var imgSix = 6;

function Loader(){
MM_preloadImages('images/img_scroll/1.jpg','images/img_scroll/2.jpg','images/img_scroll/3.jpg','images/img_scroll/4.jpg','images/img_scroll/5.jpg','images/img_scroll/6.jpg','images/img_scroll/7.jpg','images/img_scroll/8.jpg','images/img_scroll/9.jpg','images/img_scroll/10.jpg','images/img_scroll/11.jpg','images/img_scroll/12.jpg');
Scroll();
}

function Scroll(){
																					
    window.document.one.src = "images/img_scroll/" + imgOne + ".jpg";
    window.document.two.src = "images/img_scroll/" + imgTwo + ".jpg";	   							
    window.document.three.src = "images/img_scroll/" + imgThree + ".jpg";
    window.document.four.src = "images/img_scroll/" + imgFour + ".jpg";	   															
    window.document.five.src = "images/img_scroll/" + imgFive + ".jpg";
    window.document.six.src = "images/img_scroll/" + imgSix + ".jpg";
		   							
	
	if (imgOne == 12){ imgOne = 0;} 
        if (imgTwo == 12){ imgTwo = 0;} 
	if (imgThree == 12){ imgThree = 0;} 
	if (imgFour == 12){ imgFour = 0;}
	if (imgFive == 12){ imgFive =0;} 
	if (imgSix == 12){ imgSix = 0;}
							
	imgOne++;
	imgTwo++;
	imgThree++;
	imgFour++;
	imgFive++;
	imgSix++;

	the_timeout = setTimeout("Scroll();",1000);

}


