function CreateBookmarkLink(title,url) {

if (window.sidebar) { // Mozilla Firefox Bookmark
	window.sidebar.addPanel(title, url,"");
} else if( window.external ) { // IE Favorite
	window.external.AddFavorite( url, title); }
else if(window.opera && window.print) { // Opera Hotlist
	return true; }

}

function openWin(loc) {
	window.open(loc,'popupwin','height=400,width=790,top=200,left=200,scrollbars=yes');
	return;
}

function handleMissingImage(imageObj,size) {
	if (!size) {
		size=100;
	}
	imageObj.src = "/best-price-search/images/no-image.jpg";
}

function areYouSure(url) {
	
	if (confirm('Are you sure you want to do that?')) {
		document.location.href=url;
	}
	
}

function showHide(layer) {
	ls = document.getElementById(layer).style;
	if (ls.display=='block') {
		ls.display='none';
	} else {
		ls.display='block';
	}
	return;
}

function show(layer) {
	ls = document.getElementById(layer).style;
	ls.display='block';
	return;
}

function hide(layer) {
	ls = document.getElementById(layer).style;
	ls.display='none';
	return;
}
function hideAll() {
	hide("salarySurveys");
	hide("reportsSpeeches");
	hide("aboutUs");
}

/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* 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);
}

/* Taken from http://www.dustindiaz.com/getelementsbyclass/ */
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function setField(field,val) {
	document.getElementById(field).value = val;
	return;
}

function submitSafe(msg,form) {
	var confirmBox = confirm(msg);	
	if (confirmBox == true) {
		document.getElementById(form).submit();
	}
	else {
		return false;	
	}
}

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
} 

function referHide() {
	document.getElementById("hideMe").style.display = "none";
	var tb = document.getElementById("message");
	tb.innerHTML = "Please provide brief information regarding the nature of their business here.";
	tb.onclick = function() { this.innerHTML = ""; }
	tb.onblur = function() { if (this.innerHTML == "") {
									this.innerHTML = "Please provide brief information regarding the nature of their business here.";
									}
							 }
	
}

function initStuff() {
	
	externalLinks();	
	if (document.getElementById('referPageExists')) {
		referHide();	
	}
	if (document.getElementById('loginsInfo')) {
		
		
	}
}
var mouseY;
var mouseX
function getMouse(e) {
	var IE = document.all;
	var o = document.getElementById("loginsInfo");
	var clientsW;
	if (IE) {
		mouseY = event.clientY; // - document.getElementById("col3").scrollTop;
		mouseX = event.clientX;
		clientsW = document.body.clientWidth;
	} else {
		mouseY = e.pageY;
		mouseX = e.pageX;
		clientsW = window.innerWidth
	}
	mouseY -= 80;
	mouseX -= 170;
	//var leftWidths = document.getElementById("col1").style.width + document.getElementById("col2").style.width;
	
	//if (mouseX < (leftWidths + ((clientsW-300)/2))) {
	//	mouseX += (leftWidths + ((clientsW-300)/2)) - mouseX;
	//}

	
	
}
function showBox(day,visit,ref) {
	
	if (document.getElementById("loginsInfo")) {
		
		var o = document.getElementById("loginsInfo");
		o.innerHTML = "<p><span class='head'>Date</span>: " + ref + "</p>";
		o.innerHTML += "<p><span class='head'>Visits</span>: " + visit + "</p>";
		o.style.left = mouseX+"px";
		o.style.top = mouseY+"px";
	}
}

function returnBox(){
		if (document.getElementById("loginsInfo")) {
			var o = document.getElementById("loginsInfo");
			o.style.top = "-150px";	
		}
}
var IE = document.all;
if (!IE) { document.captureEvents(Event.MOUSEMOVE); }
document.onmousemove=getMouse;


if(window.attachEvent){
            window.attachEvent('onload', initStuff);
        }
        else{
            window.addEventListener('load', initStuff, false);
        }

try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}