
var sliderHeight = "150px";
var open_height = "180px";

var marginheight = "75px";
var open_margin = "45px";

  function contentloader(key) {
    var $active = jQuery(".iPhoneACT");
	$active.addClass("iPhoneIMG");
	$active.removeClass("iPhoneACT");
	$active.css("opacity","0.3");
	$active.attr("src", "images/iphone/"+$active.attr('id')+".png");
    var $newActive = jQuery("#"+key);
	$newActive.removeClass("iPhoneIMG");	
	$newActive.addClass("iPhoneACT");
	$newActive.attr("src", "images/iphone/"+key+"_c.png");
	var lang = jQuery('#lang').attr('value');
	if(lang!=''){
	    jQuery("#phoneCon").load("index.php?eID=getContent&key="+key+"&lang="+lang+"");		
	}else{
		jQuery("#phoneCon").load("index.php?eID=getContent&key="+key+"");
	}
  }


jQuery(document).ready(function(){
    jQuery('#layer').each(function () {
                var current = jQuery(this);
                current.attr("box_h", current.height());
            }
     );

	
	jQuery(".iPhoneIMG").livequery(function() {
         jQuery(this).click(function() { contentloader(this.id) })
	});
	jQuery("area#areaEurasien").mouseover(function() { changeMap('eurasien')})
	jQuery("area#areaEurasien").mouseout(function() { changeMap('off')})	
	jQuery("area#areaUSA").mouseover(function() { changeMap('usa')})
	jQuery("area#areaUSA").mouseout(function() { changeMap('off')})
	jQuery("area#areaAfrika").mouseover(function() { changeMap('afrika')})
	jQuery("area#areaAfrika").mouseout(function() { changeMap('off')})
	jQuery("area#areaInd").mouseover(function() { changeMap('india')})
	jQuery("area#areaInd").mouseout(function() { changeMap('off')})
	jQuery("area#areaAussi").mouseover(function() { changeMap('australia')})
	jQuery("area#areaAussi").mouseout(function() { changeMap('off')})
	jQuery("area#areaEast").mouseover(function() { changeMap('east')})
	jQuery("area#areaEast").mouseout(function() { changeMap('off')})
    jQuery("#layer").css("height", sliderHeight);
    jQuery("#layer").mouseover(function() { openSlider() })
    jQuery("#layer").mouseout(function() { closeSlider() })
    jQuery("#layer").click(function() { openBanner() })
    jQuery("p.close").click(function() { closeBanner() })
    jQuery("div.closeBtn").click(function() { closeBanner() })	
 
});

function changeMap(map) {
	var $active = jQuery("#weltDiv IMG.active");
    var $next =  jQuery("#weltDiv IMG#"+map);

    $active.addClass("last-active");

    $next.css({opacity: 0.0})
        .addClass("active")
        .animate({opacity: 1.0}, 200, function() {
			$active.removeClass("active last-active");
        });
}


 
function openBanner()
{
    jQuery("#layerCon").slideDown("slow");
}

function closeBanner()
{
    jQuery("#layerCon").slideUp("slow");
}

function openSlider()
{
    jQuery("#layer").stop().animate({"height": open_height,"marginTop": open_margin}, {duration: "slow" });
}
 
function closeSlider()
{
    jQuery("#layer").stop().animate({"height": sliderHeight,"marginTop": marginheight}, {duration: "slow" });
}

jQuery(document).ready(function() {
	jQuery('.fadeThis').append('<span class="hover"></span>').each(function () {
	  var $span = jQuery('> span.hover', this).css('opacity', 0);
	  jQuery(this).hover(function () {
	    $span.stop().fadeTo(500, 1);
	  }, function () {
	    $span.stop().fadeTo(500, 0);
	  });
	});
});

jQuery(function() {
// OPACITY OF BUTTON SET TO 50%

jQuery("map *").tooltip({ positionLeft: true,    
						showBody: " - ", 
						showURL: false, 
						fade: 250  });

jQuery(".iPhoneIMG").css("opacity","0.3");
 
// ON MOUSE OVER
jQuery(".iPhoneIMG").livequery(function() {
         jQuery(this)
		 	.hover(function () {
 
				// SET OPACITY TO 100%
				jQuery(this).stop().animate({
				opacity: 1.0
				}, "slow");
				},

			// ON MOUSE OUT
			function () {

				// SET OPACITY BACK TO 50%
				jQuery(this).stop().animate({
				opacity: 0.3
				}, "slow");
			});
    }, function() { 
        // unbind the mouseover and mouseout events 
        jQuery(this)
            		 	.hover(function () {
 
				// SET OPACITY TO 100%
				jQuery(this).stop().animate({
				opacity: 1.0
				}, "slow");
				},

			// ON MOUSE OUT
			function () {

				// SET OPACITY BACK TO 50%
				jQuery(this).stop().animate({
				opacity: 1
				}, "slow");
			});
    });

	});


