/**
 * ID Tabs - Main navigation control
 */
$(document).ready(function(){	
	
	//$.ifixpng('../_graphics/pixel.gif');
	//$('img[@src$=.png]').ifixpng();	
	
	$("#mainNav").idTabs("!mouseover")
	
	$(".idTabs a").mouseout(function (event) {
	  if(event.pageY < "147") {
	  	setNavigationHighlight(event);
	  }
	});
	
	$("div#mainNav div").mouseout(function (event) {
	  	if($("li.industries a").attr("class") == "selected" || $("li.expertise a").attr("class") == "selected") {
		  if(event.pageY > "190" || event.pageY < "147" ) {
			  setNavigationHighlight();
		  }
		} else {
		  if(event.pageY > "175" || event.pageY < "147" ) {
			  setNavigationHighlight();
		  }			
		}

	});
	
	setNavigationHighlight();
	
	$(".idTabs .aboutus a").mousedown(function (event) {
		window.setTimeout('window.location.href = "http://www.sqs-group.com/about_us/company_profile.htm"', 200);
	});

	$(".idTabs .expertise a").mousedown(function (event) {
		window.setTimeout('window.location.href = "http://www.sqs-group.com/expertise/expertise.htm"', 200);		
	});

	$(".idTabs .investors a").mousedown(function (event) {
		window.setTimeout('window.location.href = "http://www.sqs-group.com/investors/overview.htm"', 200);		
	});	
	
	$(".idTabs .industries a").mousedown(function (event) {
		window.setTimeout('window.location.href = "http://www.sqs-group.com/industries/associations.htm"', 200);		
	});	

	$(".idTabs .careers a").mousedown(function (event) {
		window.setTimeout('window.location.href = "http://www.sqs-group.com/careers/working_at_sqs.htm"', 200);		
	});	
	
});



/**
 * Set navigation highlight to tab navigation when website prebuild starts.
 */
function setNavigationHighlight() {
	var bodyClass = $("body").attr("class");
	
	switch(bodyClass) {
		case "homeCat":
		case "sitemapCat":
		case "contactCat":
		case "imprintCat":		
		case "disclaimerCat":
		case "searchCat":
		case "countryCat":
		case "conferencesCat":		
			$("#mainNav").idTabs("empty");
			break;
		case "aboutusCat":
			$("#mainNav").idTabs("aboutus");
			break;
		case "expertiseCat":
			$("#mainNav").idTabs("expertise");
			break;			
		case "investorsCat":
			$("#mainNav").idTabs("investors");
			break;
		case "industriesCat":
			$("#mainNav").idTabs("industries");
			break;
		case "careersCat":
			$("#mainNav").idTabs("careers");
			break;	
	}
}

/* Image Map Mouse Over */
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;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function gotoLanguage(language) {
	switch(language) {
		case "german":
			window.location.href = "http://www.sqs-group.com/deutsch/index.htm";
			break;
		case "english":
			window.location.href = "http://www.sqs-group.com/index.htm";
			break;
			}
}

function gotoCountry(country) {
	switch(country) {
		case "overview":
			window.location.href = "http://www.sqs-group.com/country/country.htm";
			break;
		case "germany":
			window.location.href = "http://www.sqs.de";
			break;
		case "united_kingdom":
			window.location.href = "http://www.sqs-uk.com";
			break;
		case "switzerland":
			window.location.href = "http://www.sqs-group.ch";
			break;
		case "austria":
			window.location.href = "http://www.sqs.at";
			break;
		case "portugal":
			window.location.href = "http://www.sqs.pt";
			break;
		case "ireland":
			window.location.href = "http://www.sqs-ire.com";
			break;
		case "netherlands":
			window.location.href = "http://www.sqs-group.nl";
			break;
		case "south_africa":
			window.location.href = "http://www.sqs-sa.com";
			break;
		case "egypt":
			window.location.href = "http://www.sqs-group.com/country/country_eg.htm";
			break;		
		case "sweden":
			window.location.href = "http://www.sqs-nordic.com";
			break;	
		case "finland":
			window.location.href = "http://www.sqs-nordic.com";
			break;	
		case "norway":
			window.location.href = "http://www.sqs-nordic.com";
			break;	
		case "usa":
			window.location.href = "http://www.sqs-group.com/country/country_usa.htm";
			break;	
		case "india":
			window.location.href = "http://www.sqs-india.com";
			break;	
			
	}
}

function hideAllLayers() { //hide all
  MM_showHideLayers('start','','hide','germany','','hide','united_kingdom','','hide','switzerland','','hide','austria','','hide','portugal','','hide','ireland','','hide','netherlands','','hide','south_africa','','hide','egypt','','hide','india','','hide','usa','','hide','sweden','','hide','norway','','hide','finland','','hide')
  }