// JQUERY
$(document).ready(function(){
	// banner slideshow
	$('#slide-container').cycle({
		height:  '178px',	// container height
	    fade:     1,		// true for fade, false for slide 
	    speed:    'slow',	// any valid fx speed value 
	    timeout:  3000,		// ms duration for each slide 
	    random:   0,       // true for random, false for sequence 
	    fit:      0,       // force slides to fit container 
	    pause:    0,       // true to enable "pause on hover" 
	    autostop: 0        // true to end slideshow after X slides have been shown (where X == slide count) (note that if random == true not all slides are guaranteed to have been shown) 
	});
	
	// anti spam form validation
	$('input,textarea').keypress(function(){
  			this.form.elements.pv.value='verified';
  		});
	
	// receive email updates
	$('#submitButton').click(function(){
		var strReceiveUpdates = $("input[@name='receive_email_updates']:checked").val();
		if (strReceiveUpdates == 'yes') {
			//alert(strReceiveUpdates);
			$("#emailUpdates").attr("value", strReceiveUpdates);
		}
		//return true;
	});				
});

/* drop down menu */
function dropdown(obj,stat) {
	idx=fDOM(obj);
	idx.style.visibility=(stat) ? "visible" : "hidden";
}
function fDOM(obj) {
	if (document.getElementById) return (document.getElementById(obj));
	else return (0);
}

/* generic pop-up window */
function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=825,height=618,left=200,top=200');");
}

/* image swap on hover */
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
