// JavaScript Document

(function($) {  //don't want to conflict with other framework
	jQuery(document).ready(function() {
	    // Options for SuperBGImage
		$.fn.superbgimage.options = {
			transition: 1,
			randomtransition: 0, // 0-none, 1-use random transition (0-7)
			slideshow: 0, // 0-none, 1-autostart slideshow
			slide_interval: 5000, // interval for the slideshow
			randomimage: 1, // 0-none, 1-random image
			speed: 'slow' // animation speed
		};
		// initialize SuperBGImage
		$('#superbgimage').superbgimage().hide();
		
		$(document).pngFix();
		
		//Navigation
		$.swapImage(".swapImage", true, true, "mouseenter", "mouseleave"); 
		$('ul.jdMenu').jdMenu({activateDelay: 1000, disableLinks:false});
		
		var url = location.pathname;
		
		/*
		if ((url.indexOf("canton_document") >= 0) || (url.indexOf("interview_detail") >= 0)) {
			//Image captions
			$('.sCaptioned').sCaption({
				backgroundColor: '#000000', //Color del fondo
				opacity: 60, //Opacidad del fondo
				shadow: true, //Mostrar sombra
				shadowColor: '#000000', //Color de la sombra
				shadowDisplacement: 2, //Desplazamiento de la sombra
				margin: 10, //Margen del texto dentro del fondo
				fontFamily: 'arial', //Familia de la fuente utilizada en el caption
				fontSize: '10px', //Tamaņo de la fuente
				fontWeight: 'normal', //Peso de la fuente
				fontColor: '#ffffff' //Color de la fuente
			});
  		}
  		*/
		
		/* Navigation on mouseover */
		$('.navItem').bind('mouseenter', 
						   function() {
							   $(this).addClass('navItem-hover');
						}
		);
		$('.navItem').bind('mouseleave', 
						   function() {
							   $(this).removeClass('navItem-hover');
						}
		);
		/* END of Navigation on mouseover */

		//set height for windows
		var height = $(window).height();
		height = height - 150;
		//var a = $('#pageRight').(".content");
		$(".content").height((height));
	});
})(jQuery);

function switchLang(newLang) {
	newLang = '/' + newLang + '/';
	theUrl = new String(location.href);
	theUrl = theUrl.replace(/\/en\//gi, newLang);
	theUrl = theUrl.replace(/\/tc\//gi, newLang);
	theUrl = theUrl.replace(/\/sc\//gi, newLang);
	location.href = theUrl;
}

function imgSwap(oImg)
{
   var strOver  = "_on"    // image to be used with mouse over
   var strOff = "_off"     // normal image
   var strImg = oImg.src
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff)
   else
      oImg.src = strImg.replace(strOff,strOver)
}
