
function searchby_occasion_dd() {
 // alert (  document.getElementById("searchby_occasion").value  );	
window.document.location.href = '/Product.aspx?query=Keyword%1F' + document.getElementById("searchby_occasion").value;
return false;
}

function searchby_price_dd() {
 // alert (  document.getElementById("searchby_price").value  );
  window.document.location.href = '/Product.aspx?query=PriceRange%1F' + document.getElementById("searchby_price").value;  
return false;
}



function searchby_maintext() {
 // alert (  document.getElementById("searchby_price").value  );
  window.document.location.href = '/Product.aspx?query=' + document.getElementById("maintext_search").value;  
return false;
}


function searchClick()
{
	  if(document.getElementById("searchby_price").value.length > 0)
	  {
			//var queryURLEncoded = encodeURIComponent(document.forms[0].{0}.value);
			//document.location = '{1}' + '?query=' + queryURLEncoded;
			//alert("test");
			window.document.location.href = '/Product.aspx?query=' + document.getElementById("maintext_search").value; 
	  }
}

function txtSearchQueryKeyPress(evt)
{
	  if(evt.keyCode == 13)
	  {
			searchClick()
			return false; // cancel submit
	  }
	  
	  return true;
}






/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
      window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
      var elem = document.createElement('a');
      elem.setAttribute('href',url);
      elem.setAttribute('title',title);
      elem.setAttribute('rel','sidebar');
      elem.click();
} 
else if(document.all)// ie
      window.external.AddFavorite(url, title);
}







function getUrlVars(){
	var vars = [], hash;
	var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

	for(var i = 0; i < hashes.length; i++)
	{
	hash = hashes[i].split('=');
	vars.push(hash[0]);
	vars[hash[0]] = hash[1];
	}
	return vars;
}
function display_search_choice(){
	var getvars = [];
	getvars =  getUrlVars();

	if(getvars['query']){
		var mySplitResult = getvars['query'].split("%1F");
		if (mySplitResult[0] == 'PriceRange' ) {
		//	alert("price "+ mySplitResult[1]);
			document.getElementById("searchby_price").value  = mySplitResult[1];
		}
		else{
			if (mySplitResult[0] == 'Keyword' ) {
		//		alert("Key "+ mySplitResult[1]);
				mySplitResult[1] = mySplitResult[1].replace('%20',' ');
		//		alert("Key "+ mySplitResult[1]);
				document.getElementById("searchby_occasion").value  = mySplitResult[1];		
			}
		}
	}
}












// *******************************************************************************************
// Code added tempoarily to give warning message on purchase.
// *******************************************************************************************

function extra_checkoutinfo(){

	var deliveryRequired = "";
	$('input.checkout_delivery_date').each(function(intIndex) {
		var a = $(this).val() 
		if (a.length == 0){
			deliveryRequired = "Please note delivery dates are required for each purchase, Thank you.\n\n";
		}
	});
	
	var giftmessageCheckOnce = 0;
	checkoutready = 0;	
	$('textarea.checkout_giftmessage').each(function(intIndex) {
		if (giftmessageCheckOnce == 0){
			testing = $(this).val();
			if (testing.length > 0)
			 {
				//alert("giftmessage ok!");
			   //document.getElementsByName("pageViwer$CENTER_COL_MAINTEXT3$ctl00$ctl00$ctl18")[0].click();   
			  }
			 else
			 {
				var where_to= confirm(deliveryRequired + "You have not entered a Gift Message for one of your products. \nPlease click cancel if you would like to add your gift message. \n\nPlease click ok to proceed on to payment."); 
					if (where_to == true)
					{
						giftmessageCheckOnce  = 1;
						//alert("giftmessage ok!");
						 //document.getElementsByName("pageViwer$CENTER_COL_MAINTEXT3$ctl00$ctl00$ctl18")[0].click();  
					}
					else
					{
						giftmessageCheckOnce  = 1;
						checkoutready = 1;
					}		
			  } 
		  }
	});
	if (checkoutready != 1)   {
		document.getElementsByName("pageViwer$content5$ctl00$ctl00$ctl16")[0].click();
	}

	
	
}



function recalculatebasket() {
	var arr = new Array();
	arr = document.getElementsByName('pageViwer$content6$ctl00$ctl00$pnlBasket$ctl05');
    var obj = document.getElementsByName('pageViwer$content6$ctl00$ctl00$pnlBasket$ctl05').item(0);
    obj.click();
}



















