/*  
Site Name: 		CUNET
Site URI: 		cunet.com
Description: 	CUnet
Version: 		1.0
Author: 		Emir Plicanic
Author URI: 	Nelnet.com

*/

jQuery(document).ready(function() {

/*  =ROUND ABOUT
---------------------------------------------------*/
	  //load roundabout only if available in DOM
	  if(jQuery('ul#cunetRoundabout').length > 0){

	      jQuery('ul#cunetRoundabout').roundabout({
			 minOpacity: 0.9,
			 duration: 800,
			 tilt: -2.3,
			 minScale: 0.8,
			 minZ:20,
			 maxZ:200,
			 easing: 'easeInOutExpo',
			 clickToFocus: true
		  });
	  }
	 
	 //function to either enable or disable links on ittems that are not in focus
	  jQuery('.roundabout-moveable-item a').not('.roundabout-in-focus a').click(function() { 
	 		//to enable click
	        var openpage = jQuery(this).attr("href");
			window.location = openpage;
	 });
	 

/*  =END ROUND ABOUT
---------------------------------------------------*/


/* = Table Roll Over
---------------------------------------------------------------------*/
	 jQuery(".highlight-rows tr").hover(function() {
	    jQuery(this).children("td").css({ "background-color": "#f1f1f1" });											
	},function(){
	    jQuery(this).children("td").css({ "background-color": "#fff" });	
	}); 

/* = End Table Roll Over
---------------------------------------------------------------------*/

/* = Schedule Visit Button
---------------------------------------------------------------------*/
	jQuery("#schedulebutton, .completeform").click(function() {
	    jQuery("#schedulevisit").stop().slideToggle("fast");									
	});
/* = END Schedule Visit Button
---------------------------------------------------------------------*/

/* = Request Info Button
---------------------------------------------------------------------*/
	jQuery("#requestinfo").click(function() {
	    jQuery("#webinarinfo").stop().slideToggle("fast");									
	});
/* = END Request Info Button
---------------------------------------------------------------------*/

/* = MOBILE FIX for image width
---------------------------------------------------------------------*/

	jQuery("img").not("#promo img").each(function() {
	if (jQuery(this).width() > 160) {
	        var w = jQuery(this).width();
			var h = jQuery(this).height();
			
			var ratio = h / w;
			var currH = 0;
			
			currH = 160 * ratio;
			jQuery(this).height(currH);
			jQuery(this).width(160);
					
		}	
	});
	
/* = MOBILE FIX for image width
---------------------------------------------------------------------*/

	/* Share this form and contact us form */
	var dlgShareForm = jQuery("#shareForm").dialog({
	    bgiframe: true,
	    width: 250,
	    height: 425,
	    modal: true,
	    autoOpen: false,
	    buttons: {
	        'Cancel': function() {
	            jQuery(this).dialog('close');
	        }
	    }
	});

	jQuery("a.open_share").click(function() {
	    dlgShareForm.parent().appendTo(jQuery('form:first'));
	    jQuery("#shareForm").dialog('open');
	    return false;
	});

	var dlgContactForm = jQuery("#contactForm").dialog({
	    bgiframe: true,
	    width: 250,
	    height: 425,
	    modal: true,
	    autoOpen: false,
	    buttons: {
	        'Cancel': function() {
	            jQuery(this).dialog('close');
	        }
	    }
	});


	jQuery("a.open_contact").click(function() {

	    dlgContactForm.parent().appendTo(jQuery('form:first'));
	    jQuery("#contactForm").dialog('open');
	    return false;
	});
	/*End of share this form and contact us form */

});
