
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)
	  {
		//alert("test");
			searchClick()
			return false; // cancel submit
	  }
	  
	  return true;
}

function click_on_search_box_clear()
{
	document.getElementById("maintext_search").value = "";
}











/* 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(){
	checkoutready = 0;	
	$('textarea.checkout_giftmessage').each(function(intIndex) {
		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("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)
				{
					//alert("giftmessage ok!");
					 //document.getElementsByName("pageViwer$CENTER_COL_MAINTEXT3$ctl00$ctl00$ctl18")[0].click();  
				}
				else
				{	
					checkoutready = 1;
				}		
		  } 
	});
	if (checkoutready != 1)   {
		document.getElementsByName("pageViwer$content5$ctl00$ctl00$ctl16")[0].click();
	}
*/
	
	
	
/*

 if (document.getElementById("pageViwer_CENTER_COL_MAINTEXT3_ctl00_ctl00_ctl17_txtGiftMessage").value.length > 0)
 {
   document.getElementsByName("pageViwer$CENTER_COL_MAINTEXT3$ctl00$ctl00$ctl24")[0].click();   
  }
 else
 {
	var where_to= confirm("You have not entered a Gift Message. \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)
		{
			document.getElementsByName("pageViwer$CENTER_COL_MAINTEXT3$ctl00$ctl00$ctl24")[0].click();   
		}
		else
		{			
		}		
  } 
  
*/

//}



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();
}



















