// 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")
	/* var ccc = 3 && 0;
	alert(ccc); */
	
  $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) +']');
	  /* alert('link clicked'); */
	  if ($target.length) {
		var targetOffset = $target.offset().top;
		$j('html,body')
		.animate({scrollTop: targetOffset}, 900);
	   return false;
	  }
	}
  });
});$j(document).ready(function(){	
	if ($j(".level_0")) {		
		$j(".level_0 li").css("background", "none")	
	}
	if ($j("#ApplicationSubmit")) {
		//$j('input#ApplicantEmail').val(' ');
		$j("#ApplicationSubmit").click(function() {
			//alert($j('input#ApplicantEmail').val());
		});
	}
	
});

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

function checkboxclick(variable1){
	/*check box validation; 2 checked*/
	//if ($j("input[type='checkbox']:checked").size() > 3 ){
		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();


/* $j("#contactCapcha a").trigger('click'); */

/* $j("#contactCapcha a").click(function(){
	alert('refresh button was clicked');
}); */
	//form ajax and animation
	/* $j("#search_pagelinks .pagination li a").click(function(e){ 
		e.preventDefault();
		if (e.preventDefault) { 
		
		var obj = new Object(); //Create new object
		obj[] = $j.post()
		var str=""; //variable which will hold property values
		for(prop in obj)
		{
		str+=prop + " value :"+ obj[prop]+"\n";//Concate prop and its value from object
		}
		alert(str);
			
		}
		
	}); */
	/* formAction = $j("#searchForm").attr("action");
	try {
		$j("#searchintro2").remove();
	}
	catch(err) {}
	$j("#searchForm").submit(function() {
		submitForm();
		return false;
	});
	var start = '10';
	$j("#search_pagelinks .pagination li a").click(function(e){
		e.preventDefault();
		if (e.preventDefault) {
			if ($j.browser.msie) {
				var start = '';
				try {
					E.returnValue=true;
					alert("this is ie! with no error");
					submitForm(1);
				} catch (err) {
					alert("this is ie! with error");
					//E.returnValue=true;
					var hashes = window.location.href.slice(window.location.href);
					//alert(hashes);
					//submitForm(5);
					window.location = hashes+'&start=10';
				}
			}
		}
		var a_href = this.href;
		if (a_href.search('searchphrase=') > 0) {
			if (a_href.search('#ContactUs') > 0) { // do nothing
			} else {
				$j("#searchForm").attr("action", a_href);
				// get the value of start int from the link url
				try {
					var long_ahref = a_href.split("start=");
					var limitstart = long_ahref[1].split("&");
					$j("#limitstart").val(limitstart);
				}
				catch(err) {
					$j("#limitstart").val("0");
				}
				submitForm();
			}
			return false;
		} 
		else {}
	}); */
});

/* function submitForm(data1)
{
	$j("table#searchresults").fadeOut(1000, function(){
		this.empty();
	});
	$j("#loadingResult").show(200);
	
	var str = $j("#searchForm").serialize();

	$j.post($j("#searchForm").attr("action"), str, function(data){
		try {
			$j("#loadingResult").hide(200);
		}
		catch(err) {}

		var i = data.indexOf("<table class=\"searchintro\"");
		var data1 = data.slice(i);
		i = data1.indexOf("</table>");
		data1 = data1.slice(0,i+8);
		
		i = data.indexOf("id=\"searchresults\"");
		var data2 = data.slice(i);
		i = data2.indexOf(">");
		data2 = data2.slice(i+1);
		i = data2.indexOf("</table>");
		data2 = data2.slice(0,i);
		
		try {
			$j("table.searchintro").replaceWith(data1);
			$j("table#searchresults").html(data2);
		}
		catch(err) {
			
		}
		$j("table#searchresults").fadeIn(1000);
		
		$j("#search_pagelinks .pagination li a").click(function(e){
			e.preventDefault();
			var a_href = this.href;
			if (a_href.search('searchphrase=') > 0) {
				if (a_href.search('#ContactUs') > 0) {}
				else {
					$j("#searchForm").attr("action", a_href);
					// get the value of start int from the link url
					try {
						var long_ahref = a_href.split("start=");
						var limitstart = long_ahref[1].split("&");
						$j("#limitstart").val(limitstart);	
					} 
					catch(err) {
						$j("#limitstart").val("0");
					}
					submitForm();
				}
				return false;
			}
			else {}
		});	
	}, "html");
} */


/* .css("text-decoration", "underline") */
    
