//=====================================================================
//  USE THIS FILE FOR YOUR MAIN JS FUNTIONS. 
//
//  This could include pop up windows, any google javascript, etc. 
//=====================================================================
function OpenWindowWH(WinURL,w,h) {
	var w;
	this.name="parentwindow";
	w = window.open(WinURL, "add", "width="+w+",height="+h+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
	w.focus();
}

function popUp(url,width,height,scrollbars,resizable,querystring,windowname) {
	/*
	Ultimate Pop Up Script
	Simple Example <a href="javascript:void(0);" onclick="popUp('test.php')">Pop Up</a>
	Normal Example <a href="javascript:void(0);" onclick="popUp('test.php','200','300')">Test</a>
	Full Example   <a href="javascript:void(0);" onclick="popUp('test.php','200','300', 0, 1,'?cid=1', 'popup1')">Test 2</a>
	
	To use default just use null in t place of the variable
	  IE: <a href="javascript:void(0);" onclick="popUp('test.php','200','300', null, null,'?cid=1', 'popup1')">Test 2</a>
	  This uses the default variable for scrollbars and resizable
	*/ 
	if(typeof width == "undefined" || width == null)	var width	= 500;
	if(typeof height == "undefined" || height == null)	var height	= 400;
	
	if(typeof scrollbars == "undefined" || scrollbars == null)		var scrollbars	= 0;
	if(typeof resizable == "undefined" || resizable == null)		var resizable	= 0;
	if(typeof querystring == "undefined" || querystring == null)	var querystring	= '';
	if(typeof windowname == "windowname" || windowname == null)		var windowname	= 'popup';
	
	var full_url = url + querystring;

	var w;
	w = window.open(full_url, windowname, "width="+width+",height="+height+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+scrollbars+",resizable="+resizable);
	w.focus();
}

function swapListingImage(whichImage, image_div, image_resizer, width) {
	if (whichImage != '') {
		if(typeof image_resizer == "undefined" || width == null)	var image_resizer	= 'imgresize.inc.php';
		if(typeof width == "undefined" || width == null)			var width			= 200;
		
		document.getElementById(image_div).src = 'inc_php/'+image_resizer+'?w='+width+'&constrain=1&img='+whichImage;
	}
}

function bookmarkSite(page_url, page_title) {
	/*
	Ultimate Bookmark/Add-to-Favorites Script
	Browsers Compatible: IE5+ Win, IE5 Mac, FF (Win/*nix), Netscape 6+, Opera 7+, Safari, Konqueror 3, iCab 3
	*/
	var user_agent	= navigator.userAgent.toLowerCase();
	var isKonq		= (user_agent.indexOf('konqueror') != -1);
	var isSafari	= (user_agent.indexOf('webkit') != -1);
	var isMac		= (user_agent.indexOf('mac') != -1);
	var buttonStr	= isMac ? 'Command/Cmd' : 'CTRL';

	if(window.external && (!document.createTextNode || (typeof(window.external.AddFavorite) == 'unknown'))) {
		// IE5+ Win
		window.external.AddFavorite(page_url, page_title);
	} else if (window.sidebar) {
		// FF Win
		window.sidebar.addPanel(page_title, page_url, "");
	} else if(isKonq) {
		// Konquerer
		alert('You need to press CTRL + B to bookmark our site.');
	} else if(window.opera) {
		// Opera (doesn't support bookmarking
		void(0);
	} else if(window.home || isSafari) {
		// FF *nix, Netscape, Safari, iCab
		alert('You need to press '+buttonStr+' + D to bookmark our site.');
	} else if(!window.print || isMac) {
		// IE Mac and Safari 1.0
		alert('You need to press Command/Cmd + D to bookmark our site.');    
	} else {
		alert('In order to bookmark this site you need to do so manually through your browser.');
	}
}