function doSearch()
{
    if (event.which || event.keyCode)
    {
        if ((event.which == 13) || (event.keyCode == 13)) 
        { 
            var oButt = document.getElementById("ctl00_plcMain_imbSearch");
            
            event.returnValue = false;
            event.cancel = true;
            oButt.click();
        }    
    }
}


function ValidateSearch()
{
    var key = document.getElementById("ctl00_plcMain_txtSearchKey").value;
    
    if (trim(key) != "")
    {
        //alert(key);
        location.href = "/CMSTemplates/Securesafe/search.aspx?key=" + key;
        return true;
    }
    else
    {
        alert("Please enter a keyword to search.");
        return false;
    }
}

function emailPage()
{
    var loc, bdy; 
    
    loc = escape(eval(window.location)).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27'); 
    bdy = "Dear Friend, One of your friends thought that you might be interested in this.";	
    bdy += " You can view it at, " + loc; 
    bdy += "<br><br>Regards,<br>Your Friend.";
    window.location = "mailto:?subject=:: Securesafe.co.uk :: &body=" + bdy;
}

function printPage() {if (window.print)	window.print();	else alert("Sorry, your browser doesn't support this feature.");}

function CreateBookmarkLink() 
{ 
	title = document.title;   
	
	url = "http://www.SecureSafe.co.uk";  
		
	if (window.sidebar) 
	{ 		
		window.sidebar.addPanel(title, url,"");	
	} 
	else if( window.external ) 
	{ 		
		window.external.AddFavorite( url, title); 
	}	
	else if(window.opera && window.print) 
	{ 
		var mbm = document.createElement('a');
		mbm.setAttribute('rel','sidebar');
		mbm.setAttribute('href',url);
		mbm.setAttribute('title',title);
		mbm.click();
	 
	} 
} 

function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}