
function initMap() {
	$('#map area').hover(
        function() {
            $('#map-hover #' + $(this).attr('alt')).addClass('hover');
        },
        function() {
            $('#map-hover #' + $(this).attr('alt')).removeClass('hover');
        }            
    );
}

function initMapTabs() {

    $('#map.tabset2 .tab').click(function() {
        $('#map-hover li').removeClass('activestate');
        $('#map-hover li#' + $(this).attr('alt')).addClass('activestate');

        $('#parent-holder .tab-content').css('display', 'none');
        $('#parent-holder #' + $(this).attr('href').replace('#', '') + '.tab-content').css('display', 'block');

        $('#region-container').css('visibility', 'visible');

		if($(this).attr('alt') == 'asia_pacific') {
			$('#selected-region').addClass('small');
		}
		else {
			$('#selected-region').removeClass('small');
		}

        $('#selected-region').html($(this).attr('rel').replace(/^(.)|\s(.)/g, function($1){ return $1.toUpperCase( ); }));

        getMapDetails($(this).attr('alt'), '', '');

        return false;
    });

}
$(document).ready(function(){
	 $('.asia, .africa, .europe, .americas').addClass("hide");
	 $('#map.tabset2 .tab').click(function() {
	  $('.asia, .africa, .europe, .americas').addClass("hide");

	  if($(this).attr("href")=="#tab-7")
		  { $(".intro").addClass("hide");
			$('.africa, .europe, .americas').addClass("hide");
			$('.asia').removeClass("hide");

              $("div.asia li a").click(function () {

              $("li a").removeClass("active");
              $(this).addClass("active");
              var id = $(this).attr('id');
              if($(this).attr("class")=="active")
                {
                  $("div#content_asia").children().addClass("hide");
                  $("div #contents" + "-" + id).removeClass('hide');
                }
              });

		  }
	  if($(this).attr("href")=="#tab-4")
		  { $(".intro").addClass("hide");
			$('.asia, .europe, .americas').addClass("hide");
			$('.africa').removeClass("hide");
            $("div.africa li a").click(function () {

              $("li a").removeClass("active");
              $(this).addClass("active");
              var id = $(this).attr('id');
              if($(this).attr("class")=="active")
                {
                  $("div#content_africa").children().addClass("hide");
                  $("div #contents" + "-" + id).removeClass('hide');
                }
              });
		  }
      if($(this).attr("href")=="#tab-5")
		  { $(".intro").addClass("hide");
			$('.asia, .africa, .americas').addClass("hide");
			$('.europe').removeClass("hide");
            $("div.europe li a").click(function () {

              $("li a").removeClass("active");
              $(this).addClass("active");
              var id = $(this).attr('id');
              if($(this).attr("class")=="active")
                {
                  $("div#content_europe").children().addClass("hide");
                  $("div #contents" + "-" + id).removeClass('hide');
                }
              });
		  }

       if($(this).attr("href")=="#tab-2")
		  { $(".intro").addClass("hide");
			$('.asia, .africa, .europe').addClass("hide");
			$('.americas').removeClass("hide");
            $("div.americas li a").click(function () {

              $("li a").removeClass("active");
              $(this).addClass("active");
              var id = $(this).attr('id');
              if($(this).attr("class")=="active")
                {
                  $("div#content_americas").children().addClass("hide");
                  $("div #contents" + "-" + id).removeClass('hide');
                }
              });
		  }
});
    /**
     * Homepage big images
    */


    /**
     * Try to login the customer via Ajax. Triggered when 'GO' button
     * from header is clicked
    */
  
 	


    /**
     * Initialize stuff from markup
    */
    initMapTabs();
    //initMapTabsDetails();
    initMap();
    initButtonHover();

    /**
     * Lightbox for resource images on Media, News and Pages
    */


});


/*IE 6 hover plagin*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('9 u=k(){9 g=/^([^#.>`]*)(#|\\.|\\>|\\`)(.+)$/;k u(a,b){9 c=a.J(/\\s*\\,\\s*/);9 d=[];n(9 i=0;i<c.l;i++){d=d.v(o(c[i],b))};6 d};k o(a,b,c){a=a.z(" ","`");9 d=a.r(g);9 e,5,m,7,i,h;9 f=[];4(d==8){d=[a,a]};4(d[1]==""){d[1]="*"};4(c==8){c="`"};4(b==8){b=E};K(d[2]){w"#":7=d[3].r(g);4(7==8){7=[8,d[3]]};e=E.L(7[1]);4(e==8||(d[1]!="*"&&!x(e,d[1]))){6 f};4(7.l==2){f.A(e);6 f};6 o(7[3],e,7[2]);w".":4(c!=">"){5=p(b,d[1])}y{5=b.B};n(i=0,h=5.l;i<h;i++){e=5[i];4(e.C!=1){q};7=d[3].r(g);4(7!=8){4(e.j==8||e.j.r("(\\\\s|^)"+7[1]+"(\\\\s|$)")==8){q};m=o(7[3],e,7[2]);f=f.v(m)}y 4(e.j!=8&&e.j.r("(\\\\s|^)"+d[3]+"(\\\\s|$)")!=8){f.A(e)}};6 f;w">":4(c!=">"){5=p(b,d[1])}y{5=b.B};n(i=0,h=5.l;i<h;i++){e=5[i];4(e.C!=1){q};4(!x(e,d[1])){q};m=o(d[3],e,">");f=f.v(m)};6 f;w"`":5=p(b,d[1]);n(i=0,h=5.l;i<h;i++){e=5[i];m=o(d[3],e,"`");f=f.v(m)};6 f;M:4(c!=">"){5=p(b,d[1])}y{5=b.B};n(i=0,h=5.l;i<h;i++){e=5[i];4(e.C!=1){q};4(!x(e,d[1])){q};f.A(e)};6 f}};k p(a,b){4(b=="*"&&a.F!=8){6 a.F};6 a.p(b)};k x(a,b){4(b=="*"){6 N};6 a.O.G().z("P:","")==b.G()};6 u}();k Q(a,b){9 c=u(a);n(9 i=0;i<c.l;i++){c[i].R=k(){4(t.j.H(b)==-1){t.j+=" "+b}};c[i].S=k(){4(t.j.H(b)!=-1){t.j=t.j.z(b,"")}}}}4(D.I&&!D.T){D.I("U",V)}',58,58,'||||if|listNodes|return|subselector|null|var||||||||limit||className|function|length|listSubNodes|for|doParse|getElementsByTagName|continue|match||this|parseSelector|concat|case|matchNodeNames|else|replace|push|childNodes|nodeType|window|document|all|toLowerCase|indexOf|attachEvent|split|switch|getElementById|default|true|nodeName|html|hoverForIE6|onmouseover|onmouseout|opera|onload|ieHover'.split('|'),0,{}))
/*parameters [selector, hover_class]*/
function ieHover() {
	hoverForIE6("#nav li, .box-list li, #header .search-box span, .login-form span, .box-holder .input-row span", "hover");
}


function initButtonHover() {
    if (typeof document.body.style.maxHeight == 'undefined') ie6 = true;
    else ie6 = false;
    var inputs = document.getElementsByTagName("input");
    for(var i=0; i<inputs.length; i++) {
        if(inputs[i].type == "image") {
            if (ie6) {
                if (inputs[i].src.indexOf(".png") != -1) {
                    var src = inputs[i].src;
                    inputs[i].path = inputs[i].src;
                    inputs[i].src = "images/none.gif";
                    inputs[i].runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
                }
            }
            inputs[i].onmouseover = function() {
                if(this.path && ie6) this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.path.replace(this.path, this.path.substr(0, this.path.lastIndexOf(".")) + "-hover" + this.path.substr(this.path.lastIndexOf("."))) + "',sizingMethod='scale')";
                else this.src = this.src.replace(this.src, this.src.substr(0, this.src.lastIndexOf(".")) + "-hover" + this.src.substr(this.src.lastIndexOf(".")));
            }
            inputs[i].onmouseout = function() {
                if(this.path && ie6) this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.path + "',sizingMethod='scale')";
                this.src = this.src.replace("-hover", "");
            }
        }
    }
}

