// JavaScript Document
$(document).ready(function() { 
	if ($('#validate_form').length != 0){
		$("#validate_form").validate();
	}
	if ($('.slideshow').length != 0){
		$('.slideshow').cycle({
			fx: 		'fade',
			speed:    	2000, 
			timeout:  	4000,
			pause:   	1,
			next:   	'#next', 
			prev:   	'#prev'
		});
		$('.slideshow').css('visibility', 'visible');
	}
});
		
if(typeof hs != "undefined") {
	hs.graphicsDir = '/assets/images/highslide/';
	hs.align = 'center';
	hs.transitions = ['expand', 'crossfade'];
	hs.outlineType = 'rounded-white';
	hs.fadeInOut = true;
	//hs.dimmingOpacity = 0.75;
	// Add the controlbar
	hs.addSlideshow({
		//slideshowGroup: 'group1',
		interval: 5000,
		repeat: false,
		useControls: true,
		fixedControls: 'fit',
		overlayOptions: {
			opacity: .75,
			position: 'bottom center',
			hideOnMouseOut: true
		}
	});	
}

alertMsg = "Right-clicking on this page is disabled!";
browserVersion = parseInt(navigator.appVersion)
isNetscape = navigator.appName=="Netscape"
isIE = navigator.appName=="Microsoft Internet Explorer"

function noRightClick(evnt) {
  if (isNetscape && evnt.which > 1){
   alert(alertMsg)
   return false
  } else if (isIE && (event.button > 1)) {
   alert(alertMsg)
   return false;
  }
}

function validate(formData, jqForm, options) { 	
	var reqFields = $('input.required');
    //for (var i=0; i < formData.length; i++) { 
	for (var i=0; i < reqFields.length; i++) { 
		if (!reqFields[i].value){
			alert('Please enter a value for ' + reqFields[i].name + '!'); 
            return false; 
		} 
    } 
}

document.onmousedown = noRightClick;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (isNetscape && browserVersion < 5) window.onmousedown = noRightClick;
