// JavaScript Document

//clearing the search box
function clearBox(textBox){
	textBox.value = "";
}
//create global variable to store popup window ref (required when printing popups below)
var winPrint;
//printing current page
function printCurPage(URL) {
	//first trim off the URL #anchorlinks
	if(URL.indexOf("#") >= 0)
	{
		URL = URL.substring(0,URL.indexOf("#"));
	}
	
	//open page as printer-friendly version
	winPrint = window.open(URL + '?ver=print','pageprint','scrollbars=yes,width=600,height=400');
	
//first make sure print method is supported by current browser
	if(window.print)
	{
		setTimeout('winPrint.print()', 4000);
		
	}
	else
	{
		alert("Your browser does not support this feature!!\n\nPlease use your Browser Toolbar to print Current Page!!");
	}
		setTimeout('winPrint.close()',7000);
}

//emailing current page
function emailCurPage(URL,title) {
	//first trim off the URL #anchorlinks
	if(URL.indexOf("#") >= 0)
	{
		URL = URL.substring(0,URL.indexOf("#"));
	}
	else if(URL.indexOf("?") >= 0)
	{
		URL = URL.substring(0,URL.indexOf("?"));
	}
	//MM_openBrWindow('page_mailer.php?pageURL=' + URL + '&pageTitle=' + title + '','pagemailer','scrollbars=yes,width=400,height=390')
	top.location.href = 'https://www.buildingcentre.com/emailtoafriend.php?pageURL=' + URL + '&pageTitle=' + title;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}