
/**************************************************
	jQuery ZEBRA Tables (table class="zebra")
**************************************************/

$(document).ready(function(){
  $("table.zebra tr:nth-child(even)").addClass("even");
  $("table.zebra tr:nth-child(odd)").addClass("odd");
  $("table.zebra-grey tr:nth-child(even)").addClass("even");
  $("table.zebra-grey tr:nth-child(odd)").addClass("odd");
});


/**************************************************
	jQuery Toggler
**************************************************/

$(document).ready(function() {
		$('.toggled').hide();
          $('.toggler').click(function() {
               if ($(this).next('.toggled').is(":hidden"))
               {
                    $(this).addClass("active");
					$(this).next('.toggled').slideDown("fast");
               } else {
				    $(this).removeClass("active");
                    $(this).next('.toggled').slideUp("fast");
               }
          });
     });

/**************************************************
	jQuery Accordion
**************************************************/


$(document).ready(function(){
	//use javascript to close the divs so if deactivated the divs will still be visible
	$(".accordion dd").hide();
	
	//Show the first dd on page opening
	//$("dl.accordion dd:first").show();
	//$(".accordion dd:nth-child(1)").show();
	$(".accordion dd.accordionload").show();
	
	//set the background to open
	//$("dl.accordion dt:first").addClass("selected");
	//$(".accordion dt:nth-child(1)").addClass("selected");
	$(".accordion dt.accordionload").addClass("selected");
	
	
	//when click on the dt: close every previous opened dd, change their style, open the next children (dd), change its background.
	$(".accordion dt").click(function(){
		
		if(!$(this).next().is(':visible')) {

			$(".accordion dd").slideUp('400');
			$(".accordion dt").removeClass("selected");
			$(this).addClass("selected");
			///$(this).next().addClass("selected");
			
		}
		
		$(this).next().removeClass("selected").slideDown('400');
		return false;
	});
});	


/**************************************************
	M2 Tabs
**************************************************/
/*
$(function () {
			var tabContainers = $('div.tabs > div');
			tabContainers.hide().filter(':first').show();
			
			$('div.tabs ul.tabNavigation a').click(function () {
				tabContainers.hide();
				tabContainers.filter(this.hash).show();
				$('div.tabs ul.tabNavigation a').removeClass('selected');
				$(this).addClass('selected');
				return false;
			}).filter(':first').click();
		});

*/
$(function () {
			var tabContainers = $('div.tabs > div');
			tabContainers.hide().filter(':first').show();
			
			$('div.tabs ul.tabmenu a').click(function () {
				tabContainers.hide();
				tabContainers.filter(this.hash).show();
				$('div.tabs ul.tabmenu a').removeClass('selected');
				$(this).addClass('selected');
				return false;
			}).filter(':first').click();
		});

/**************************************************
	General JS
**************************************************/

function openPictureWindow_Fever(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop) {  // v4.01
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	if (imageType == "swf"){
	newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
	newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('</embed></object>');	}else{
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">'); 	}
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function Lvl_openWin(u,n,w,h,l,t,c,f) { //v2.2 4LevelWebs
  var x=((screen.width-w)/2);if(c==1){l=x;t=(screen.height-h)/2;}if(c==2){l=x}
	f+=',top='+t+',left='+l;LvlWin=window.open(u,n,f);LvlWin.focus();
}

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;
}


