/* DISABLE CONSOLE LOG BEGIN */
if (!window.console || !console.firebug)
{
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

    window.console = {};
    for (var i = 0; i < names.length; ++i)
        window.console[names[i]] = function() {}
}
/* DISABLE CONSOLE LOG END */



function pageLauncher() {
	
	
			$().ready(function() {
  				$('#ex2').jqm({ajax: 'video_popover.html', trigger: 'a.ex2trigger'});
			});
}
		

function toggle(carry){
	if (document.getElementById(carry).style.display == "block"){
		document.getElementById(carry).style.display = "none";
		if (carry == "location_selectordiv"){
			document.getElementById("location_selector").className = "";
		}
	}
	else{
		document.getElementById(carry).style.display = "block";
		if (carry == "location_selectordiv"){
			document.getElementById("location_selector").className = "close";
		}
	}
}
	
function show(carry)
	{ 
		document.getElementById(carry).style.display = "block"; 
	}
	
	
function hide(carry)
	{
		document.getElementById(carry).style.display = "none";
	}
	
	
function showMainNav(carry)
	{
		show('mainnav_'+carry+'');
		document.getElementById(carry+'_off').style.background = "#dcdcdc";
	}

	
function locationLetterSwitch(layer_ref)
	{
		$("#country_list_container div").hide();
		$("#country_list_container #country_list_"+layer_ref).show();
		$("#letters a").removeClass("on"); 
		$("#letter_"+layer_ref).addClass("on");
	}
function showLogin()
	{
		$(".overlayTarget .overlayClose").removeClass("overlayClose");
		$(".overlayContainer").hide();
		$("#online_signin_off").hide(); 
		document.getElementById('online_signin_on').style.display = "block";
		$("#login_overlay").show();
	}
	
function hideLogin()
	{
		$("#online_signin_on").hide(); 
		$("#login_overlay").hide();
		$("#online_signin_off").show();
	}
	
$(function(){
	$.ajax({
		url: "includes/services-overlay.html",
		success: function(html){
			$("body").append(html);
		}
	});
	$.ajax({
		url: "includes/country-overlay.html",
		success: function(html){
			$("body").append(html);
		}
	});
	$.ajax({
		url: "includes/main-nav-overlay.html",
		success: function(html){
			$("body").append(html);
			contentLoaded();
		}
	});
});

function contentLoaded(){
	$("#mainnav a").click(function(){
		if(!$(this).hasClass("on")){
			$("#mainnav a").removeClass("on");
			$(this).addClass("on");
			$(".overlayTarget .overlayClose").removeClass("overlayClose");
			$(".overlayContainer").hide();
		}
	});

	$(".subNavLeft li").hover(
		function(){
			$(this).css({
				"background-color":"white",
				"background-image":"url(images/global/overlay-yellow-bkg.gif)",
				"background-position":"left top",
				"background-repeat":"repeat-y"
			});
		},
		function(){
			$(this).css({
				"background-color":"",
				"background-image":""
			});
		}
	);
	
	if ($.browser.msie && $.browser.version < "7"){
		$(".subNavLeft a").css("margin-left", "10px");
		$("#login_overlay").css({"right":"9px","top":"14px"});
	}
	
	if (navigator.platform == "Win32"){
		$("#industryOverlayContent").css({"left":"0px"});
		$(".subNavContainer").css({"left":"-189px"});		
		if ($.browser.msie && $.browser.version < "7"){
			$("#industryOverlayContent ul").css("margin-left","10px");
			$(".subNavRight").css("width","460px");
			$(".subNavLeft").css("width","225px");
			$(".subNavRight ul.subUlFirst").css("width","215px");
			$("#industryOverlayContent").css("bottom","-2px");
		}
		if ($.browser.msie && $.browser.version >= "7"){
		}
		if ($.browser.msie){
		}
		if ($.browser.mozilla){
		}
	}
	
	
	$(".subNavLeft li a").click(function(){
		if (!$(this).parent("li").hasClass("subNavOn")){
			$(this).parent("li").siblings("li").removeClass("subNavOn");
			$(this).parent("li").addClass("subNavOn");
			var subNavClass = $(this).attr("class");
			$(this).parent().parent().parent(".subNavLeft").siblings(".subNavRight").children("div").hide();
			$(this).parent().parent().parent(".subNavLeft").siblings(".subNavRight").children("." + subNavClass).show();
		}
	});
	
	$(".subNavRight div").eq(0).each(function(){
		$(this).css("display","block");
	});
	
	$(".overlayLink").click(function(){
		var overlayName = $(this).attr("id");
		console.log(overlayName);
		if ( $("#" + overlayName + "Content").parent(".overlayContainer").css("display") == "none" ){
			$(".overlayTarget .overlayClose").removeClass("overlayClose");
			$(".overlayContainer").hide();
			hideLogin();
			var offset = $(this).offset();
			$("#" + overlayName + "Content").parent(".overlayContainer").css({
				"top":offset.top + "px",
				"left":offset.left + "px"
			});
			$("#" + overlayName + "Content").parent(".overlayContainer").show();
			$(this).addClass("overlayClose");
		} else {
			$("#" + overlayName + "Content").parent(".overlayContainer").hide();
			$(this).removeClass("overlayClose");
		}
	});
	$(".subNavClose").click(function(){
		$(this).parent().parent().parent(".overlayContainer").hide();
		$("#mainnav a").removeClass("on");
	});
	$(".industryBorderCover").click(function(){
		$(".overlayTarget .overlayClose").removeClass("overlayClose");
		$(".overlayContainer").hide();
	});
	
	$("body").append('<div class="hidden"><img src="images/global/drop-down-close.jpg" /></div>')
}
