/*
Clears default form values
example usage: <input id="locator" name="locator" type="text" size="15" value="zip/postal code" onFocus="clearText(this)" />
*/

function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 

/*
Flash Sniffer
Copyright (c) 2007, James Auldridge
Code licensed under the BSD License: http://www.jaaulde.com/license.txt
updated by Kevin Flahaut 01/04/2008
example usage - add directly below the <body> tag: <script type="text/javascript">document.write(FlashResultsOutput);</script>
*/

var checkFlash = window.checkFlash || {};
checkFlash.utils = checkFlash.utils || {};
checkFlash.utils.flashsniffer = {
	lastMajorRelease: 9,
	installed: false,
	version: null,
	detect: function()
	{
		var fp,fpd,fAX;
		if (navigator.plugins && navigator.plugins.length)
		{
			fp = navigator.plugins["Shockwave Flash"];
			if (fp)
			{
				checkFlash.utils.flashsniffer.installed = true;
				if (fp.description)
				{
					fpd = fp.description;
					checkFlash.utils.flashsniffer.version = fpd.charAt(fpd.indexOf('.')-1);
				}
			}
			else
			{
				checkFlash.utils.flashsniffer.installed = false;
			}
			if (navigator.plugins["Shockwave Flash 2.0"]){
				checkFlash.utils.flashsniffer.installed = true;
				checkFlash.utils.flashsniffer.version = 2;
			}
		}
		else if (navigator.mimeTypes && navigator.mimeTypes.length)
		{
			fp = navigator.mimeTypes['application/x-shockwave-flash'];
			if (fp && fp.enabledPlugin)
			{
				checkFlash.utils.flashsniffer.installed = true;
			}
			else
			{
				checkFlash.utils.flashsniffer.installed = false;
			}
		}
		else
		{
			for(var i=checkFlash.utils.flashsniffer.lastMajorRelease;i>=2;i--)
			{
				try
				{
					fAX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
					checkFlash.utils.flashsniffer.installed = true;
					checkFlash.utils.flashsniffer.version = i;
					break;
				}
				catch(e)
				{
				}
			}
			if(checkFlash.utils.flashsniffer.installed == null){
				try
				{
					fAX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
					checkFlash.utils.flashsniffer.installed = true;
					checkFlash.utils.flashsniffer.version = 2;
				}
				catch(e)
				{
				}
			}
			if(checkFlash.utils.flashsniffer.installed == null)
			{
				checkFlash.utils.flashsniffer.installed = false;
			}
			fAX = null;
		}
	},
	isVersion: function(exactVersion)
	{
		return (checkFlash.utils.flashsniffer.version!=null && checkFlash.utils.flashsniffer.version==exactVersion);
	},
	isLatestVersion: function()
	{
		return (checkFlash.utils.flashsniffer.version!=null && checkFlash.utils.flashsniffer.version==checkFlash.utils.flashsniffer.lastMajorRelease);
	},
	meetsMinVersion: function(minVersion)
	{
		return (checkFlash.utils.flashsniffer.version!=null && checkFlash.utils.flashsniffer.version>=minVersion);
	}
};
checkFlash.utils.flashsniffer.detect();

// write the flash results to the page -- set minimum flash version here.

	var FlashResultsOutput = '<div id="flashinfo"';
	if(!checkFlash.utils.flashsniffer.meetsMinVersion(8)){FlashResultsOutput += 'style="display:block;" ';}
	FlashResultsOutput += '><div id="closelink" style="float:right; width:70px; height:12px;"><a href="javascript:;" onclick="document.getElementById(\'flashinfo\').style.display = \'none\';" >close x</a></div>'
	
	// Is Flash installed and if so, what version?
	var installedVerbiage;
	checkFlash.utils.flashsniffer.installed===true ? installedVerbiage = '' : installedVerbiage = 'not ';
	FlashResultsOutput += 'Flash player version '+checkFlash.utils.flashsniffer.version+' is installed but does not meet minimum requirements. '

	if(checkFlash.utils.flashsniffer.version!=null){
	
	// Does the flash version meet a specified minimum requirements?
	FlashResultsOutput += 'Version 8 or higher is required for proper viewing of this site. <a href="http://www.adobe.com/products/flashplayer/" target="blank" title="download the free flash player">Download Current Version</a>';

	FlashResultsOutput += '</div>'
	}
	//
	
/*
	-----------------------------------------------------------------------------------
	Dom Image Rollover
	Description: This script makes it easy to add rollover/ mousedown 
  	effects to any image on the page, including image submit buttons. Automatically 
  	preloads images as well. Script works in all DOM capable browsers- IE5+, NS6+, 
  	Opera7+.
	
	Legal: Copyright 2005 Adam Smith
	Author Email Address: ibulwark@hotmail.com
	Date Created: June 6, 2005
	Website: Codevendor.com | eBadgeman.com
	Script featured on Dynamic Drive: http://www.dynamicdrive.com
	
	example: <img src="src" srcover="over.jpg" srcdown="srcover">
	-----------------------------------------------------------------------------------
*/

function imageholderclass(){
	this.over=new Array();
	this.down=new Array();
	this.src=new Array();
	this.store=store;
	
	function store(src, down, over){
		var AL=this.src.length;
		this.src[AL]=new Image(); this.src[AL].src=src;
		this.over[AL]=new Image(); this.over[AL].src=over;
		this.down[AL]=new Image(); this.down[AL].src=down;
	}
}

var ih = new imageholderclass();
var mouseisdown=0;

function preloader(t){
	for(i=0;i<t.length;i++){
		if(t[i].getAttribute('srcover')||t[i].getAttribute('srcdown')){
			
			storeimages(t[i]);
			var checker='';
			checker=(t[i].getAttribute('srcover'))?checker+'A':checker+'';
			checker=(t[i].getAttribute('srcdown'))?checker+'B':checker+'';
			
			switch(checker){
			case 'A' : mouseover(t[i]);mouseout(t[i]); break;
			case 'B' : mousedown(t[i]); mouseup2(t[i]); break;
			case 'AB' : mouseover(t[i]);mouseout(t[i]); mousedown(t[i]); mouseup(t[i]); break;
			default : return;			
			}
			
			if(t[i].src){t[i].setAttribute("oldsrc",t[i].src);}
		}
	}
}
function mouseup(t){
	var newmouseup;
	if(t.onmouseup){
		t.oldmouseup=t.onmouseup;
		newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("srcover");this.oldmouseup();}

	}
	else{newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("srcover");}}
	t.onmouseup=newmouseup;
}

function mouseup2(t){
	var newmouseup;
	if(t.onmouseup){
		t.oldmouseup=t.onmouseup;
		newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("oldsrc");this.oldmouseup();}
		}
	else{newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("oldsrc");}}
	t.onmouseup = newmouseup;
}

function mousedown(t){
	var newmousedown;
	if(t.onmousedown){
		t.oldmousedown=t.onmousedown;
		newmousedown=function(){if(mouseisdown==0){this.src=this.getAttribute("srcdown");this.oldmousedown();}}
	}
	else{newmousedown=function(){if(mouseisdown==0){this.src=this.getAttribute("srcdown");}}}
	t.onmousedown=newmousedown;
}

function mouseover(t){
	var newmouseover;
	if(t.onmouseover){
		t.oldmouseover=t.onmouseover;
		newmouseover=function(){this.src=this.getAttribute("srcover");this.oldmouseover();}
	}
	else{newmouseover=function(){this.src=this.getAttribute("srcover");}}
	t.onmouseover=newmouseover;
}

function mouseout(t){
	var newmouseout;
	if(t.onmouseout){
		t.oldmouseout=t.onmouseout;
		newmouseout=function(){this.src=this.getAttribute("oldsrc");this.oldmouseout();}
	}
	else{newmouseout=function(){this.src=this.getAttribute("oldsrc");}}
	t.onmouseout=newmouseout;
}

function storeimages(t){
	var s=(t.getAttribute('src'))?t.getAttribute('src'):'';
	var d=(t.getAttribute('srcdown'))?t.getAttribute('srcdown'):'';
	var o=(t.getAttribute('srcover'))?t.getAttribute('srcover'):'';
	ih.store(s,d,o);
}

function preloadimgsrc(){
	if(!document.getElementById) return;
	var it=document.getElementsByTagName('IMG');
	var it2=document.getElementsByTagName('INPUT');
	preloader(it);
	preloader(it2);
}

if(window.addEventListener){window.addEventListener("load", preloadimgsrc, false);} 
else{
	if(window.attachEvent){window.attachEvent("onload", preloadimgsrc);}
	else{if(document.getElementById){window.onload=preloadimgsrc;}}
}

function open_window(url,name,windowWidth,windowHeight){
	myleft=(screen.width)?(screen.width-windowWidth)/2:100;
	mytop=(screen.height)?(screen.height-windowHeight)/2:100;
	properties = "width="+windowWidth+",height="+windowHeight+",scrollbars=yes, top="+mytop+",left="+myleft;
	window.open(url,name,properties)
}

function open_video(name){
	if( v = document.getElementById( name ) ){
		
		Shadowbox.open({
			content:    '/video.php?vid='+name,
			player:     "iframe",
			height:     400,
			width:      600
		});
		
	}// end if
}// end function - open_video