//=====================================================================
//  USE THIS FILE FOR YOUR MAIN JS FUNTIONS. 
//
//  This could include pop up windows, any google javascript, etc. 
//=====================================================================

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 submit_form(which) {
    which.form.submitted.value = 'yes';
    which.form.submit();
}