$(function() {
//	$('#callback-fade').tipsy({fade: true});
//	$('#basket-fade').tipsy({fade: true});
//	$('#help-fade').tipsy({fade: true});
//	$('#email-fade').tipsy({fade: true});
//	$('#checkout-fade').tipsy({fade: true});
//	$('#account-fade').tipsy({fade: true});
	$('.tipsyClass').tipsy({fade: true, html: true});
});
//<![CDATA[[
//$BTB={s:12198};
//$BTB.jsh="btbuckets.com/bt.js";
//]]>
//$BTB.jshost = (document.location.protocol == "https:")?"https://ssl.":"http://static.";
//document.write(unescape("%3Cscript src='" + $BTB.jshost + $BTB.jsh + "' type='text/javascript'%3E%3C/script%3E"));

function goto(form) { var index=form.select.selectedIndex
if (form.select.options[index].value == "http://www.toppsbathrooms.co.uk"){
window.open(form.select.options[index].value)
}
else if (form.select.options[index].value == "standardFinder" || form.select.options[index].value == "groutFinder" || form.select.options[index].value == "adhesiveFinder"  || form.select.options[index].value == "woodflooringFinder"  || form.select.options[index].value == "laminateflooringFinder"  || form.select.options[index].value == "engineeredflooringFinder" ){
	document.getElementById("standardFinder").style.display = "none";
	document.getElementById("groutFinder").style.display = "none";
	document.getElementById("adhesiveFinder").style.display = "none";
	document.getElementById("woodflooringFinder").style.display = "none";
	document.getElementById("laminateflooringFinder").style.display = "none";
	document.getElementById("engineeredflooringFinder").style.display = "none";	
	document.getElementById(form.select.options[index].value).style.display = "block";
}
else if (form.select.options[index].value != "0") {
location=form.select.options[index].value;}}


function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=450,height=450,left = 520,top = 250');");
}


function searchRestore(trade){
		if (document.getElementById("search").value == ""){
			document.getElementById("search").style.background = "url(/images/searchinputbg" + trade + ".gif)"
		}
	}
	
	
function toggleDiv(divID){
	if (document.getElementById(divID).style.display == 'none'){
		document.getElementById(divID).style.display = 'block'
	} else {
		document.getElementById(divID).style.display = 'none'
	}

}
$(document).ready(function() {
    $('.buttonChange').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		timeout: 6000,
		cleartypeNoBg: true
	});
});

//to clear and change the colour of the form elements once selected
$(document).ready(function() {  
	$("#search_place").focus(function() {  
		$("#search_place").css("color", "#000");
		$("#search_place").val("");
	}); 	
	$("#search").focus(function() {  
		$("#search").css("color", "#000");
		$("#search").val("");		
	}); 
	$("#sli_search_1").focus(function() {  
		$("#sli_search_1").css("color", "#000");
		$("#sli_search_1").val("");		
	}); 
}); 

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=450,height=450,left = 520,top = 250');");
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

$(document).ready(function(){
	//hide the all of the element with class msg_body
	$(".range_body").hide();
	//toggle the componenet with class msg_body
	$(".range_head").click(function(){
		$(this).next(".range_body").slideToggle(100);
	});
});

