//$(document).ready(function(){
//$("#im_contactform").validator();
//});



//$("#im_themecolors").change(function() { 
//		$("link.im_colorsheet").attr("href",$(this).attr('value'));
//		$.cookie("csscolor",$(this).attr('value'), {expires: 365, path: '/'});
//		return false;
//	});



/* * FLOWPLAYER TABS - jQuery Plugin * */
// perform JavaScript after the document is scriptable.
$(function() {
	// setup ul.tabs to work as tabs for each div directly under div.panes

	$("ul.im_entryheadingtabs").tabs(".im_entrytabpane_wrapper > .im_entrytabpane", {	
		effect: 'fade'
	});							 
	
	$("ul.im_entrymediatabs").tabs(".im_tabpane_wrapper > .im_tabpane", {
		effect: 'fade' ,
		onClick: function() {
			jQuery.each($("iframe.im_map"), function() {
				$(this).attr({
				src: $(this).attr("src")
				});			
			});

		}
	});
});

/* * FLOWPLAYER TABS - jQuery Plugin * */

/* * SCROLLABLE  - jQuery Plugin * */
$(document).ready(function() {
	// initialize scrollable together with the navigator plugin
	$("#im_browsable").scrollable().navigator();
	$("#flowpanes").scrollable({ circular: true, mousewheel: true }).navigator({

		// select #flowtabs to be used as navigator
		navi: "#flowtabs",

		// select A tags inside the navigator to work as items (not direct children)
		naviItem: 'a',

		// assign "current" class name for the active A tag inside navigator
		activeClass: 'current',

		// make browser's back button work
		history: true

	});


});
/* * SCROLLABLE END - jQuery Plugin * */




// Andy Langton's show/hide/mini-accordion - updated 23/11/2009
// Latest version @ http://andylangton.co.uk/jquery-show-hide

//// this tells jquery to run the function below once the DOM is ready
//$(document).ready(function() {
//
//	// choose text for the show/hide link - can contain HTML (e.g. an image)
//	var showText='(+) Show All';
//	var hideText='(-) Show Latest';
//	
//	// initialise the visibility check
//	var is_visible = false;
//	
//	// append show/hide links to the element directly preceding the element with a class of "toggle"
//	$('.im_toggle').prev().prepend(' <a href="#" class="toggleLink">'+showText+'</a> ');
//	
//	// hide all of the elements with a class of 'toggle'
//	$('.im_toggle').hide();
//	
//	// capture clicks on the toggle links
//	$('a.toggleLink').click(function() {
//	
//		// switch visibility
//		//is_visible = !is_visible;
//		
//		if ($(this).text()==showText) {
//			$(this).text(hideText);
//			$(this).parent().next('.im_toggle').slideDown('slow');
//		} else {
//			$(this).text(showText);
//			$(this).parent().next('.im_toggle').slideUp('slow');
//		}
//				
//		// return false so any link destination is not followed
//		return false;
//	
//});
	
		
//FAQS
$(document).ready(function() {

	// choose text for the show/hide link - can contain HTML (e.g. an image)
	var showAnswer='(+) Show Answer';
	var hideAnswer='(-) Hide Answer';
	
	// initialise the visibility check
	var is_visible = false;
	
	// append show/hide links to the element directly preceding the element with a class of "toggle"
	$('.im_toggle_answer').prev().prepend(' <a href="#" class="toggleAnswer">'+showAnswer+'</a> ');
	
	// hide all of the elements with a class of 'toggle'
	$('.im_toggle_answer').hide();
	
	// capture clicks on the toggle links
	$('a.toggleAnswer').click(function() {
	
		// switch visibility
		//is_visible = !is_visible;
		
		if ($(this).text()==showAnswer) {
			$(this).text(hideAnswer);
			$(this).parent().next('.im_toggle_answer').slideDown('fast');
		} else {
			$(this).text(showAnswer);
			$(this).parent().next('.im_toggle_answer').slideUp('fast');
		}
				
		// return false so any link destination is not followed
		return false;
	
});


	
$(document).ready(function() {

	// hide all of the elements with a class of 'im_forgot_username'

	$('.im_forgot_username').hide();
	$('.forgotusername_btn').click(function() {

	  $('.im_forgot_username').slideToggle('fast', function() {
		// Animation complete.
	  });
	  
	  $('.im_login').toggle();
	  $('.im_forgot_password').hide();
	});
	
		// hide all of the elements with a class of 'im_forgot_username'
	$('.im_forgot_password').hide();
	
	$('.forgotpassword_btn').click(function() {
	  $('.im_forgot_password').slideToggle('fast', function() {
		// Animation complete.
	  });
	  
	   $('.im_login').toggle();
	  $('.im_forgot_username').hide();
	});

});
	

	// FOR STYLESHEET SWITCHER
	// choose text for the show/hide link - can contain HTML (e.g. an image)
	var showstylepanelText='(+) Theme Picker';
	var hidestylepanelText='(-) Theme Picker';
	
	// initialise the visibility check
	var is_visible = false;
	
	// append show/hide links to the element directly preceding the element with a class of "toggle"
	$('.im_stylepaneltoggle').next().prepend(' <a href="#" class="im_stylepaneltab">'+showstylepanelText+'</a> ');
	
	// hide all of the elements with a class of 'toggle'
	$('.im_stylepaneltoggle').hide();
	
	// capture clicks on the toggle links
	$('a.im_stylepaneltab').click(function() {
	
		// switch visibility
		//is_visible = !is_visible;
		
		if ($(this).text()==showstylepanelText) {
			$(this).text(hidestylepanelText);
			$(this).parent().prev('.im_stylepaneltoggle').slideDown('fast');
		} else {
			$(this).text(showstylepanelText);
			$(this).parent().prev('.im_stylepaneltoggle').slideUp('fast');
		}
				
		// return false so any link destination is not followed
		return false;
	
	});
});

$(document).ready(function() {
/* * STYLESHEET SWICTHER- jQuery Plugin * */
if($.cookie("csscolor")) {
		$("link.im_colorsheet").attr("href",$.cookie("csscolor"));
	}
	
if($.cookie("cssbackground")) {
		$("link.im_backgroundsheet").attr("href",$.cookie("cssbackground"));
	}
//if($.cookie("css")) {
//		$("link.changeme").attr("href",$.cookie("css"));
//	}

			   
//	$("#style1 li a").click(function() { 
//		$("link.changeme").attr("href",$(this).attr('rel'));
//		$.cookie("css",$(this).attr('rel'), {expires: 365, path: '/'});
//		return false;
//	});

	$("#im_themecolors").change(function() { 
		$("link.im_colorsheet").attr("href",$(this).attr('value'));
		$.cookie("csscolor",$(this).attr('value'), {expires: 365, path: '/'});
		return false;
	});
	
	$("#im_themebackgrounds").change(function() { 
		$("link.im_backgroundsheet").attr("href",$(this).attr('value'));
		$.cookie("cssbackground",$(this).attr('value'), {expires: 365, path: '/'});
		return false;
	});
});
/* * STYLESHEET SWICTHER - jQuery Plugin * */
	


/* * FANCY BOX - jQuery Plugin * */
$(document).ready(function() {
	/* This is basic - uses default settings */
	
	$("a.im_zoom").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	400, 
		'speedOut'		:	400, 
		'overlayShow'	:	true,
		'titlePosition' : 'outside', // 'float', 'outside', 'inside' or 'over'
		'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
		    return '<span id="fancybox-title-over">Image ' +  (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title + '</span>';
		},
		'titleFromAlt' : false,
		'showNavArrows' : true,
		'easingIn'      : 'easeOutBack',
		'easingOut'     : 'easeInBack'


	});
	
	/* Using custom settings */
	
	$("a.cp").fancybox({
		'width'				: '95%',
		'height'			: '95%',
	    'autoScale'   : false,
	    'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'				: 'iframe',
		'titlePosition'   : 'inside'
	});
});
/* * FANCY BOX END - jQuery Plugin * */


/* * NIVO SLIDER - jQuery Plugin * */
 $(window).load(function() {
	$('#im_lg_slider').nivoSlider({
		effect:'fade', //Specify sets like: 'sliceDown,sliceDownLeft,sliceUp,sliceUpLeft,sliceUpDown, sliceUpDownLeft, fold,fade,random,slideInRight,slideInLeft'
		slices:15,
		animSpeed:400,
		pauseTime:6000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:false, //Next & Prev
		directionNavHide:false, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:true, //Use thumbnails for Control Nav
      	controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded
	});
	
		$('.im_entrymedia_slide').nivoSlider({
		effect:'slideInLeft', //Specify sets like: 'sliceDown,sliceDownLeft,sliceUp,sliceUpLeft,sliceUpDown, sliceUpDownLeft, fold,fade,random,slideInRight,slideInLeft'
		slices:15,
		animSpeed:300,
		pauseTime:3000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:false, //Next & Prev
		directionNavHide:false, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:true, //Use thumbnails for Control Nav
      	controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded
	});
	 
	 	$('.im_entrymedia_slidetabbed').nivoSlider({
		effect:'slideInLeft', //Specify sets like: 'sliceDown,sliceDownLeft,sliceUp,sliceUpLeft,sliceUpDown, sliceUpDownLeft, fold,fade,random,slideInRight,slideInLeft'
		slices:15,
		animSpeed:300,
		pauseTime:3000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:false, //Next & Prev
		directionNavHide:false, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:true, //Use thumbnails for Control Nav
      	controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded
	});	
		
});

/* * SUPERFISH END - jQuery Plugin * */
$(document).ready(function(){
	$("ul.im_sf-menu").superfish({

    delay:         300,                // the delay in milliseconds that the mouse can remain outside a submenu without it closing 
    animation:     {opacity:'show'},   // an object equivalent to first parameter of jQuery’s .animate() method 
    speed:         'normal',           // speed of the animation. Equivalent to second parameter of jQuery’s .animate() method 
    dropShadows:   true,               // completely disable drop shadows by setting this to false 
    disableHI:     false,              // set to true to disable hoverIntent detection 
    onInit:        function(){},       // callback function fires once Superfish is initialised – 'this' is the containing ul 
    onBeforeShow:  function(){},       // callback function fires just before reveal animation begins – 'this' is the ul about to open 
    onShow:        function(){},       // callback function fires once reveal animation completed – 'this' is the opened ul 
    onHide:        function(){}        // callback function fires after a sub-menu has closed – 'this' is the ul that just closed 
								 });
});
/* * SUPERFISH END - jQuery Plugin * */


  // a custom onComplete handler to prevent form submits for the demo

//
//
//$(document).ready(function(validateform) {
//	$("#im_contactform").RSV({
//	  //onCompleteHandler: myOnComplete,
//	  errorFieldClass: "errorField",
//	  displayType: "display-html",
//	  errorHTMLItemBullet: "&#8212; ",
//	  rules: [
//			"required,name,Please enter your full name.",
//			"required,email,Please enter your email.",
//			"required,phone,Please enter your phone",
//			"valid_email,email,Please enter a valid email address.",
//
//    ]
//	});
//
//});



/*  ie hover plugin */

//function ieHover() {
//	hoverForIE6("#nav li", "hover");
//}



