<!-- Begin 
//Javascript for D3 PHP Mailer Version 1.5
function checkrequired(which) {
  var pass=true; 
  if (document.images) {
    for (i=0;i<which.length;i++) {
      var tempobj=which.elements[i];
      if (tempobj.name.substring(0,8)=="required") {
        if (((tempobj.type=="text"||tempobj.type=="textarea") && tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==0)) {
		  pass=false;
		  break;
        }
      }
    }
  }

  if (!pass) {
	shortFieldName=tempobj.name.substring(8,30);
	alert("Please make sure the '"+shortFieldName+"' field was properly completed.");
	tempobj.focus();
	return false;
  } else
	return true;
}

function submit_form() {
  if (checkrequired(document.frmMail)) {
    document.frmMail.submitted.value = 'yes';
    document.frmMail.submit();
  }
}
//  End -->

//=====================================================================

//  USE THIS FILE FOR YOUR MAIN JS FUNTIONS. 

//

//  This could include pop up windows, any google javascript, etc. 

//=====================================================================



function submitForm(which) {

	which.submitted.value = 'yes';

	which.submit();

}



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	= 'img.php';

		if(typeof width == "undefined" || width == null)			var width			= 200;

		

		document.getElementById(image_div).src = '/app/helpers/'+image_resizer+'?w='+width+'&constrain&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.');

	}

}



function uTimeout() {

	/*

	Ultimate Timeout Script

	--creating the timeout object--

	var myTimeout = new uTimeout()

	--standard--

	myTimeout.init(myFunction, 1000); // dont use the '()' on the function name..

	--repeating--

	myTimeout.init(myFunction, 1000, 3); // will repeat 3 times

	--passing arguments--

	myTimeout.init(myFunction, 1000, null, 'foo', 'bar', 1.6); // will call myFunction('foo', 'bar', 1.6)

	--cancelling the timeout--

	myTimeout.cancel();

	*/

    var _func				= null;		// function to call when the timeout expires

    var _timeout			= null;		// timeout length (milliseconds)

    var _repeat				= 0;		// number of times to repeat the function

    var _args				= [];		// array of arguments to pass to the function

    var _timeoutRunning		= false;	// flag to see if timeout is already running

    var _cancelled			= false;	// flag to see if timeout has been cancelled

	var _timeoutNum			= null;		// holder for the timeout

	

    this.init = function(func, timeout, repeat) {

        var i;

        

		if (_timeoutRunning || !func || !timeout)

			return false; // timeout exists, no function specified, or no timeout specified

        

        _func				= func;

        _timeout			= timeout;

        _timeoutRunning	= true;

        _cancelled			= false;

        _repeat				= repeat ? repeat : 0;

        

        _args				= [];

        for (i=3; i<arguments.length; i++) {

			// build the argument list

            _args[_args.length] = arguments[i];

        }

		

		// set the timeout!!

        _timeoutNum = setTimeout(_exec, _timeout);

    }



    this.cancel = function() {

		// cancel the timeout

		clearTimeout(_timeoutNum);

        _cancelled			= true;

        _timeoutRunning		= false;

        _repeat				= 0;

    }

    

    function _exec() {

        _timeoutRunning = false;

        if (_cancelled)

			return; // timeout was cancelled

			

        _func.apply(null, _args);

        

        if (_repeat > 0) {

			// the timeout is to be repeated!

            _repeat--;

            _timeoutNum = setTimeout(_exec, _timeout);

        }

    }

}



function isValidEmail(str) {

	var at="@"

	var dot="."

	var lat=str.indexOf(at)

	var lstr=str.length

	var ldot=str.indexOf(dot)

	if (str.indexOf(at)==-1) return false;

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)  return false;

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr) return false;

	if (str.indexOf(at,(lat+1))!=-1) return false;

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot) return false;

	if (str.indexOf(dot,(lat+2))==-1) return false;

	if (str.indexOf(" ")!=-1) return false;

	return true;

}



function toggleDiv(anchorId, contentId, anchorShowContents, anchorHideContents) {

	if (document.getElementById(contentId).style.display == '') {

		document.getElementById(contentId).style.display = 'none';

		document.getElementById(anchorId).innerHTML = anchorShowContents;

	} else {

		document.getElementById(contentId).style.display = '';

		document.getElementById(anchorId).innerHTML = anchorHideContents;

	}

}



function getPageSize(returnWhat) {

	var xScroll, yScroll;

		

	if (window.innerHeight && window.scrollMaxY) {	

		xScroll = window.innerWidth + window.scrollMaxX;

		yScroll = window.innerHeight + window.scrollMaxY;

	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac

		xScroll = document.body.scrollWidth;

		yScroll = document.body.scrollHeight;

	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari

		xScroll = document.body.offsetWidth;

		yScroll = document.body.offsetHeight;

	}

		

	var windowWidth, windowHeight;

		

	if (self.innerHeight) {	// all except Explorer

		if(document.documentElement.clientWidth){

			windowWidth = document.documentElement.clientWidth; 

		} else {

			windowWidth = self.innerWidth;

		}

		windowHeight = self.innerHeight;

	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode

		windowWidth = document.documentElement.clientWidth;

		windowHeight = document.documentElement.clientHeight;

	} else if (document.body) { // other Explorers

		windowWidth = document.body.clientWidth;

		windowHeight = document.body.clientHeight;

	}	

	

	// for small pages with total height less then height of the viewport

	if(yScroll < windowHeight){

		pageHeight = windowHeight;

	} else { 

		pageHeight = yScroll;

	}



	// for small pages with total width less then width of the viewport

	if(xScroll < windowWidth){	

		pageWidth = xScroll;		

	} else {

		pageWidth = windowWidth;

	}

	

	if (returnWhat == 'width') {

		return pageWidth;

	} else if (returnWhat == 'height') {

		return pageHeight;

	} else {

		return [pageWidth,pageHeight];

	}

}