jQuery.noConflict();


jQuery.fn.fadeToggle = function(speed, easing, callback) {
	return this.animate({opacity: 'toggle'}, speed, easing, callback);  
};
		
jQuery(document).ready(function($){

/* Latest News and Testiminials scroller */

 	jQuery('#latest-news ul').cycle({ 
	    fx: 'scrollVert',
		speed: 650,
		rev: true,
		timeout: 10000,
		next:   '#latest-news ol li.next', 
	    prev:   '#latest-news ol li.previous'
	 });      
		
	jQuery('#testimonials ul').cycle({ 
	   fx: 'scrollVert',
		speed: 650,
		rev: true,
		timeout: 10000,
		next:   '#testimonials ol li.next', 
	    prev:   '#testimonials ol li.previous'
	});	
	
	jQuery('.vticker').vTicker({
		speed: 500,
		pause: 3000,
		showItems: 3,
		animation: 'fade',
		mousePause: false,
		height: 0,
		direction: 'up'
		});
 
	jQuery('#tellfriend').hide();
  	jQuery('#iconbar a.tellafriend, #tellfriend a.close').click(function() {jQuery("#tellfriend").fadeToggle('slow');}); 
	
});


function confirmForm(f) {
	var e = "";
	
	if (!f.disclaimer.checked) {
		e += "Disclaimer is required\n";
	}
	if (f.name.value == "") {
		e += "Name is required\n";
	}
	if (f.email.value == "") {
		e += "Email is required";
	}
	if (e != "") {
		alert(e);
		return false;
	} else {
		return confirm("By clicking OK below, you affirm and understand that the information you are sending is not personal or confidential and does not create an attorney-client relationship.\n\nClick Cancel to cancel this submission.");
	}
}


	
(function($){
	function detectVideo(){
		var flash_object = '<object style="z-index:0;" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="610" height="345"><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="610" height="345" wmode="transparent"></embed></object>';
		var quicktime_object = '<object classid="clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" height="345" width="610"><param name="src" value="{path}"><param name="autoplay" value="false"><param name="scale" value="tofit"><param name="type" value="video/quicktime"><embed src="{path}" scale="tofit" height="345" width="610" autoplay="false" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>';
		var toInject = "";
		
		var divWrapper = $('.movie_container');
		var ObjectP = divWrapper.find('a');
		
		switch(ObjectP.attr('rel')){
		  
					case 'youtube':
						movie = 'http://www.youtube.com/v/'+igrab_param('v', ObjectP.attr('href'));
						toInject = flash_object.replace(/{path}/g,movie);
					break;
					
					case 'vimeo':
						movie_id = ObjectP.attr('href');
						movie = "http://vimeo.com/moogaloop.swf?clip_id="+ movie_id.replace('http://vimeo.com/','');
					  toInject = flash_object.replace(/{path}/g,movie);
					break;
					
          case 'flash':
						movie = ObjectP.attr('href');
						toInject = flash_object.replace(/{path}/g,movie);
					break;
					
					case 'quicktime':
						movie = ObjectP.attr('href');
						toInject = quicktime_object.replace(/{path}/g,movie);
					break;
		}
		
		divWrapper.html(toInject);
		
	function igrab_param(name,url){
	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	  var regexS = "[\\?&]"+name+"=([^&#]*)";
	  var regex = new RegExp( regexS );
	  var results = regex.exec( url );
	  if( results == null )
	    return "";
	  else
	    return results[1];
	}	
	
  }
  $(document).ready(function(){detectVideo();});
	
})(jQuery); 


