// JavaScript Document

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=1000,height=800,left = 460,top = 200');");
}



function MakeBeadOptions(frmname,opts,selname) {
	var opt_string = opts;
	var opt_array = opt_string.split(",");

	var s = document.forms[frmname].elements[selname];

	 if (s.options.length == 1) {
		  for (var i = 0; i < opt_array.length; i++) {
			   s.options.add(new Option(opt_array[i], opt_array[i]), s.options.length);
		  }
	 }
}


function MakeOptions(frmname,opts,selname) {
	var opt_string = opts;
	var opt_array = opt_string.split(",");

	var s = document.forms[frmname].elements[selname];

	 if (s.options.length == 1) {
		  for (var i = 0; i < opt_array.length; i++) {
			   s.options.add(new Option(opt_array[i], opt_array[i]), s.options.length);
		  }
	 }
}

function MakeSizes(frmname,opt1,opt2,selname) {

	var s = document.forms[frmname].elements[selname];
		
	for (var i = s.options.length ; i > 0 ; i--) {
    	s.options[i] = null;
	}
	
	if (opt1 != "")	
		s.options.add(new Option(opt1, opt1), s.options.length);
	if (opt2 != "")	
		s.options.add(new Option(opt2, opt2), s.options.length);
		
}

function AddVeilToBasket(description, selectedLength, selectedBeads, length1, length2, lengthPrice1, lengthPrice2, beadsPrice1, beadsPrice2, qty, col) {

	var price;
	var itemDesc;
	var nextURL;

	window.location.href = "http://www.ayedo.co.uk/acatalog/newsite.html";
	return;


	
	if (col == "Please Select One") {
		alert ("Please select a colour");
		return;
	}
	
	if (selectedLength == "Please Select One") {
		alert ("Please select a length");
		return;
	}
	
	if (selectedBeads == "Please Select One") {
		alert ("Please select beads option");
		return;
	}	
	
	<!-- validate qty  -->
	if (qty < 1) {
		alert ("No quantity entered");
		return;
	}
	
	itemDesc = description+" length:-"+selectedLength+" colour:-"+col+" Beads:-"+selectedBeads;

	<!-- Replace all spaces with a + -->
	itemDesc=itemDesc.replace(/ /g,"+");
    itemDesc=itemDesc.replace(/&/g,"and");
	
	if (selectedLength == length1) {
		price=lengthPrice1;
		if (selectedBeads != "None") {
			price = Number(lengthPrice1)+Number(beadsPrice1);
		}
	}
		
	if (selectedLength == length2) {
		price=lengthPrice2;
		if (selectedBeads != "None") {
			price = Number(lengthPrice2)+Number(beadsPrice2);
		}
	}

	nextURL="http://www.ayedo.co.uk";
			
	<!-- Add to and display basket -->
	window.location.href = "http://www.romancart.com/cart.asp?itemname="+itemDesc+"&storeid=15120&quantity="+qty+"&price="+price+"&returnurl="+nextURL;
	
}




function AddToBasket(description, cost, qty, sze, col, usedefaulturl) {

	var price;
	var itemDesc;
	var nextURL;
	
	window.location.href = "http://www.ayedo.co.uk/acatalog/newsite.html";
	return;
	
	if (col == "Please Select One") {
		alert ("Please select a colour");
		return;
	}
	
	if (sze == "Please Select One") {
		alert ("Please select a type");
		return;
	}
	
	<!-- validate qty  -->
	if (qty < 1) {
		alert ("No quantity entered");
		return;
	}
	
	if (cost <= 0) {
		alert ("Please enter an amount");
		return;
	}	

	itemDesc = description+" size:-"+sze+" colour:-"+col;

	<!-- Replace all spaces with a + -->
	itemDesc=itemDesc.replace(/ /g,"+");
    itemDesc=itemDesc.replace(/&/g,"and");

	
	price=cost;
			

	nextURL=window.location.href;
			
	<!-- Add to and display basket -->
	window.location.href = "http://www.romancart.com/cart.asp?itemname="+itemDesc+"&storeid=15120&quantity="+qty+"&price="+price+"&returnurl="+nextURL;
	
}
function homesearch(s) {

	var srch = "/listman/exec/search.cgi?search=1&";

	srch=srch+"lfield2_keyword="+s;
		
	srch=srch+"&sort_order=1&perpage=10&template=_search_results.html";
		
	window.location.href = srch;

}


function addToFav() {
  // IE
  if (document.all) {
    window.external.AddFavorite(window.location.href, document.title);
  }
  else {
    //Netscape 4.x and 6
    if(document.layers || document.getElementById){
    alert("To add this page to your favourites press \"CTRL + D\"");
    }
    else{  //Any other browser
      alert("Please add this page to your favourites manually.");
    }
  }
}
