// JAVASCRIPT FUNCTIONS
var $j = jQuery.noConflict();
// AUTOMATED SCROLLING
$j(document).ready(function(){
	$j().piroBox({
		  my_speed: 300, //animation speed
		  bg_alpha: 0.5, //background opacity
		  radius: 4, //caption rounded corner
		  scrollImage : false, // true == image follows the page _|_ false == image remains in the same open position
							   // in some cases of very large images or long description could be useful.
		  slideShow : 'true', // true == slideshow on, false == slideshow off
		  slideSpeed : 3, //slideshow
		  // Nav buttons -> piro_next == inside piroBox , piro_next_out == outside piroBox
		  // Nav buttons -> piro_prev == inside piroBox , piro_prev_out == outside piroBox
		  close_all : '.piro_close' // add class .piro_overlay(with comma)if you want overlay click close piroBox
	});
});

// JAVASCRIPT FUNCTIONS
var $j = jQuery.noConflict();
// AUTOMATED SCROLLING
$j(document).ready(function(){
	$j("#menu ul.menu > li > a > span:first-child").css("font-size", "13px")
	$j("#menu ul.menu > li > a > span:first-child").css("font-weight", "bold")
	$j("#menu ul.menu > li > a > span:first-child").css("line-height", "20px")
	$j("#userForm4 table tr td:first-child").css("width", "207px")
	$j("#userForm4 table tr td:first-child").css("vertical-align", "text-top")
	$j("#userForm4 table tr td:nth-child(2)").css("font-style", "italic")
	$j("#userForm4 table tr td span").css("padding-left", "1px")
	$j("#userForm4 table tr td span").css("color", "#808080")
	$j("#captchaTxt49").css("width", "95px")
	$j(".formError").css("color", "#ff0048")
	$j(".formError").css("font-style", "normal")
	
	/* $j('a[href*=#]').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
	var $target = $j(this.hash);
	$target = $target.length && $target || $j('[name=' + this.hash.slice(1) +']');
	if ($target.length) {
	var targetOffset = $target.offset().top;
	$j('html,body')
	.animate({scrollTop: targetOffset}, 900);
	return false;
	}
	}
	});
	 */
	
	$j('li#menuitem11').click(function() {
		$j('html,body').animate({scrollTop: document.height}, document.height);
		return false;
	});
  
});$j(document).ready(function(){
	if ($j(".level_0")) {		
		$j(".level_0 li").css("background", "none")	
	}
});

// for the left Menu ... and more stuff
// by: eM
var $j = jQuery.noConflict();

function checkboxclick(variable1){
	/*check box validation; 2 checked*/
		var total=0;
		document.getElementById("Important0").checked?total++:null;
		document.getElementById("Important1").checked?total++:null;
		document.getElementById("Important2").checked?total++:null;
		if (total > 2 ) {variable1.checked=false;}
}
$j(document).ready(function(){
	/*format for left column*/
	if ($j("#left-top").length > 0){
		var newHeight = $j("#left-top").height() ;
		do{
			newHeight++;
			$j("#left-top").height(newHeight); 
			var h1 = $j("#content").height();
			var h2 = $j("#left-column").height();
		}while(h1 > h2);
	}
	/*format for right column*/
	if ($j("#right-column").length > 0){
		var newHeight = $j("#right-mid").height(); 
		do{
			newHeight++;		
			$j("#right-mid").height(newHeight);
			var h1 = $j("#content").height();
			var h2 = $j("#right-column").height();
		}while(h1 > h2);
	}
	/*form ajax and animation*/
	$j("#userForm2").submit(function() {
		/*check box validation; 2 checked*/
		if ($j("#userForm2 input[type='checkbox']:checked").size() != 2){
			$j("#userForm2 input[type='checkbox']").attr('checked', false);
		}	
		/*ajax and animation for Contact Form*/
		var str = $j("#userForm2").serialize();
		$j.post($j("#userForm2").attr("action"), str, function(data){  
			$j("div.Contact").fadeOut("slow");	
			var i = data.lastIndexOf("<div class=\"Contact\">");
			data = data.slice(i);
			i = data.indexOf("</div>");
			data = data.slice(0,i+6);
			$j("div.rsform").after('<div id="temp" style="display:none">' + data + "</div>");
			$j("#temp div.Contact").hide();
			$j("div.Contact").replaceWith($j("#temp div.Contact"));
			$j("div.Contact").fadeIn("slow");
			$j("#temp").empty().remove();
		}, "html");
	return false;
	});
	/*Ajax for Apply Job Form*/	
	$j("#userForm3").submit(function() {
		var jobstr = $j("#userForm3").serialize();
		$j.post($j("#userForm3").attr("action"), jobstr, function(data){  
		$j("#userForm3 table").fadeOut("slow");
		var i = data.indexOf('id="userForm3"')
		data = data.slice(i-20);
		i = data.indexOf("</form>");
		data = data.slice(0,i+7);
		$j("div.rsform").after('<div id="temp" style="display:none" >' + data + "</div>");
		$j("#temp table.jobApplication").hide();
			$j("#userForm3 table").replaceWith($j("#temp table.jobApplication"));
			$j("#userForm3 table").fadeIn("slow");
			$j("#temp").empty().remove();
		}, "html");
		return false;
	});
	/*overlay function*/
	$j("#menuitem59 > a").click(function(e){
		e.preventDefault();
		openOverlay();
		return false;
	});
	$j(function() { 
		var api = $j("#overlay").overlay({api:true, start: {top: 54, left: 900, absolute: true}}); 
		// define function that opens the overlay 
		window.openOverlay = function() { 
			api.load(); 
		} 
	});
	/*fix for weird bug*/
	$j("#menuitem56 a").attr("href", "http://validator.w3.org/check?uri=referer");
	$j("#menuitem57 a").attr("href", "http://jigsaw.w3.org/css-validator/check/referer");
	/*styling for language select */

	if($j.browser.msie && jQuery.browser.version.substr(0,3)=="6.0"){
		$j(".jflanguageselection #active_language").click(function(e){
			e.preventDefault();
			$j("ul.jflanguageselection li:not(#active_language)").toggle();
		});
	}else{
		$j(".jflanguageselection").click(function(){
			$j("ul.jflanguageselection li:not(#active_language)").toggle("fast");
		});
	}
});	
// for the search menu
$j(document).ready(function(){
	/* $j("#contactCapcha a").click();
	$j(".pixsearch_search .button_search").focus(); */
}); 
