﻿var strBodyTable = 'tblLeftNav';

function doGetPageHeight() {
	var intHeight = 0;
	
	if (navigator.appName == 'Microsoft Internet Explorer') {
		intHeight = 135;
	}else	if ((navigator.appName == 'Opera') || (navigator.appName == 'Netscape')) {
		intHeight =  115;
	}
	
	return intHeight;
}

function doMaximizeBodyTable() {
	var theTable;
	
	if (navigator.appName == 'Netscape') {
		theTable = document.getElementById(strBodyTable);
		theTable.style.height = doGetPageHeight() + 'px';
	}else{
		theTable = document.getElementById(strBodyTable);
		theTable.style.height = doGetPageHeight();
	}
}

function fncPopUp(URL){
	var strName, intWidth, intHeight, intXpos, intYpos, strScroll, strResize, winBars;

	strName = 'popup';
	intWidth = 500;
	intHeight = 500;
	intXpos = 20;
	intYpos = 40;
	strScroll = 'yes';
	strResize = 'yes';
	strWinbars = 'no';

	if (fncPopUp.arguments[0] == ''){
		fncPopUp.arguments[0] = '#';
	}

	//handled agruments if they are left blank
	if (fncPopUp.arguments.length > 1) {
		strName = fncPopUp.arguments[1];
	}
	
	if (fncPopUp.arguments.length > 2){
		intWidth = fncPopUp.arguments[2];
	}
	
	if (fncPopUp.arguments.length > 3) {
		intHeight = fncPopUp.arguments[3];
	}
	
	if (fncPopUp.arguments.length > 4) {
		intXpos = fncPopUp.arguments[4];
	}
	
	if (fncPopUp.arguments.length > 5) {
		intYpos = fncPopUp.arguments[5];
	}
	
	if (fncPopUp.arguments.length > 6) {
		strScroll = fncPopUp.arguments[6];
	}
	
	if (fncPopUp.arguments.length > 7) {
		strResize = fncPopUp.arguments[7];
	}
	
	if (fncPopUp.arguments.length > 8) {
		strWinbars = fncPopUp.arguments[8];
	}
	
	if (strWinbars=='no') {
		winBars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no';
	}else{
		winBars = 'directories=yes,location=yes,menubar=yes,status=yes,titlebar=yes,toolbar=yes';
	}

	var winOptions = 'scrollbars='+ strScroll + ',resizable='+ strResize;
	var winSize = 'height=' + intHeight + ',width=' + intWidth;
	var winPosition = 'left=' + intXpos + ',top=' + intYpos;
	var winFeatures = winBars + ',' + winOptions + ',' + winSize + ',' + winPosition;

	if (window.open(URL, strName, winFeatures) == null) {
		alert('You seem to have popup blocking software enabled.\nIn order to use certain features of RateMyCarpenter, please configure your popup blocker to allow popups from ratemycarpenter.com.');
	}
}

function SearchSite() {
	var SearchText = document.getElementById('SiteSearchInput').value;
 
	if (SearchText.length == 0) {
		alert('Please enter a search term.');
		return false;
	}else{
		document.location = "/sitesearch/default.aspx?q=" + escape(SearchText);
	}
}