/* js for package: std-layout */

/*-----------------------------------------------------------------------------------------*/
/*     CUFON FONT REPLACEMENT          */
/*-----------------------------------------------------------------------------------------*/


Cufon.replace('#main-menu a.cufon_replace', { textShadow: '#000 3px 3px',  hover: true });
Cufon.replace('#special-menu a.cufon_replace', { hover: true });
Cufon.replace('#extra-menu a.cufon_replace', { hover: true });
Cufon.replace('#aaa-menu a.cufon_replace', { textShadow: '#000 3px 3px',  hover: true });
Cufon.replace('#sub-menu a', { textShadow: '#333 1px 1px', hover: true });
Cufon.replace('h1', {});
Cufon.replace('h2', {});


/*-----------------------------------------------------------------------------------------*/
/*     JART RESERVE MODE          */
/*-----------------------------------------------------------------------------------------*/

function jart_reserve(){
	$("body div:first").css("width","100%");
}

function jart_blobedit(){
	$("body div:eq(1)").css("width","100%");
	
}

/*-----------------------------------------------------------------------------------------*/
/*      RELEASE SWITCH         */
/*-----------------------------------------------------------------------------------------*/

$(document).ready(function() {

//alert($('.api_musicticket a.qTip').find(".content").html());


$(function () {
        $('#release-switch').each(function () {
            var distance = 0;
            var time = 250;
            var hideDelay = 100;

            var hideDelayTimer = null;

            var beingShown = false;
            var shown = false;
            var trigger = $('.open', this);
            var info = $('#switch', this).css('opacity', 0);


            $([trigger.get(0), info.get(0)]).mouseover(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                if (beingShown || shown) {
                    // don't trigger the animation again
                    return;
                } else {
                    // reset position of info box
                    beingShown = true;

                    info.css({
                        /*top: 0,
                        left: 0,*/
                        display: 'block'
                    }).animate({
                        top: '-=' + distance + 'px',
                        opacity: 1
                    }, time, 'swing', function() {
                        beingShown = false;
                        shown = true;
                    });
                }

                return false;
            }).mouseout(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                hideDelayTimer = setTimeout(function () {
                    hideDelayTimer = null;
                    info.animate({
                        top: '-=' + distance + 'px',
                        opacity: 0
                    }, time, 'swing', function () {
                        shown = false;
                        info.css('display', 'none');
                    });

                }, hideDelay);

                return false;
            });
        });
});
   
}); 


/*-----------------------------------------------------------------------------------------*/
/*    YOUTUBE LINKS          */
/*-----------------------------------------------------------------------------------------*/

$(document).ready(function(){
	
	$("a[href*='http://www.youtube.com']").each(function(){
		var vid = $(this).attr('href');
		var tit = $(this).html();
		var imgsrc = $.jYoutube(vid, 'small');
		var imgsrc = imgsrc.replace(/ /g, "");
		//alert(imgsrc);
		$(this).html("<div class='youtube_container'><img src='" + imgsrc + "'></img><img class='overlay' src='resources/images/youtube.png'></img></div>");
		$(this).attr('class', 'youtubelink');
		$(this).attr('href', 'resources/jquery/jyuotube/embed.jart?ylink='+encodeURIComponent(vid)+'&ytitle='+tit+'');
		$(this).attr('rel', 'lyteframe[]');
		$(this).attr('rev', 'width: 560px; height: 340px; scrolling: no;');
		$(this).attr('title', tit);
	});
						
});


/*-----------------------------------------------------------------------------------------*/
/*     JQUERY DOCUMENT READY          */
/*-----------------------------------------------------------------------------------------*/

$.fn.qtip.styles.red = {
	width: 200,
	padding: 5,
	background: '#252525',
	color: '#FFFFFF',
	textAlign: 'left',
	border: {
	         width: 3,
	         radius: 3,
	         color: '#D5031C'
	},
        tip: 'topMiddle',
	name: 'dark'

}

$.fn.qtip.styles.grey = {
	padding: 5,
	background: '#000',
	color: '#FFFFFF',
	textAlign: 'left',
	border: {
	         width: 2,
	         radius: 2,
	         color: '#555'
	},
        tip: 'bottomMiddle',
	name: 'dark'

}

$.fn.qtip.styles.top5 = {
	width: 200,
	padding: 5,
	background: '#252525',
	color: '#FFFFFF',
	textAlign: 'left',
	border: {
	         width: 3,
	         radius: 3,
	         color: '#D5031C'
	},
    tip: 'bottomRight',
	name: 'dark'

}

$(document).ready(function() {

	//$("#special-menu ul.cufon_replace > li > a").css("color", "blue");

	
	
	
	
      	
	/*SERVNAV UMBAU- open in lyteframe*/
	/*
   	$("#serv-nav a").each(function(){
		var link = $(this).attr('href');
		$(this).attr('href', link+'&change-layout=yes');
		var tit = $(this).html();
		$(this).attr('rel', 'lyteframe[]');
		$(this).attr('rev', 'width: 595px; height: 440px; scrolling: yes;');
		$(this).attr('title', tit);
	});
	*/
	
	
	$("#page-content a.qTip").each(function(){
		
		var is = $(this).find('.content img').attr('alt');
		$(this).find('.content img').attr('src', is);
		var ts = $(this).find('.content').html();
		
		$(this).qtip({  
   			content: '' + ts + '',
   			position: {
      				corner: {
         				target: 'topLeft',
         				tooltip: 'bottomRight'
      				}
  			 },
			style: 'top5' 

		});
	
	});
	
	$("#footpanel a.qTip").each(function(){
		
		var is = $(this).find('.content img').attr('alt');
		$(this).find('.content img').attr('src', is);
		var ts = $(this).find('.content').html();
		
		$(this).qtip({  
   			content: '' + ts + '',
   			position: {
      				corner: {
         				target: 'topMiddle',
         				tooltip: 'bottomMiddle'
      				}
  			 },
			style: 'grey' 

		});
	
	});
	
	$("#menu a[href='']").each(function(){
		$(this).attr('href', '#');
		$(this).attr('target', '');
		$(this).qtip({  
		  	content: 'This feature will be online soon!',
   			position: {
      				corner: {
         				target: 'bottomMiddle',
         				tooltip: 'topMiddle'
      				}
  			 },
			style: 'red' 

		});
	});
	
});


/*-----------------------------------------------------------------------------------------*/
/*      MEGA MENU        */
/*-----------------------------------------------------------------------------------------*/


$(document).ready(function() {

	//$('.MegaMenuContent').show();

/*
	$(".reserve #special-menu li").each(function(){
		
		$(this).mouseover(function(){
			//alert('hallo');
			//alert($(this).parent());
			$(this).find(".MegaMenuContent").show('slow');
		});
		
		$(this).mouseout(function(){
			//alert('hallo');
			//alert($(this).parent());
			$(this).find(".MegaMenuContent").hide('slow');
		});	
		
	});

*/

	$(".reserve #Xmenu li").each(function(){
            var distance = 0;
            var time = 25;
            var hideDelay = 10;

            var hideDelayTimer = null;

            var beingShown = false;
            var shown = false;
            var trigger = $('.cufon_replace', this);
            var info = $('.MegaMenuContent', this).css('opacity', 0);

	   //$(this).css('position', 'absolute');
	
            $([trigger.get(0), info.get(0)]).mouseover(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                if (beingShown || shown) {
                    // don't trigger the animation again
                    return;
                } else {
                    // reset position of info box
                    beingShown = true;
		        
                    info.css({
                        //top: 0,
                        //left: 0,
                        display: 'block'
                    }).animate({
                        top: '-=' + distance + 'px',
                        opacity: 1
                    }, time, 'swing', function() {
                        beingShown = false;
                        shown = true;
                    });
                }

                return false;
            }).mouseout(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                hideDelayTimer = setTimeout(function () {
                    hideDelayTimer = null;
                    info.animate({
                        top: '-=' + distance + 'px',
                        opacity: 0
                    }, time, 'swing', function () {
                        shown = false;
                        info.css('display', 'none');
                    });

                }, hideDelay);

                return false;
            });
        });


});

/*-----------------------------------------------------------------------------------------*/
/*              */
/*-----------------------------------------------------------------------------------------*/


/*-----------------------------------------------------------------------------------------*/
/*              */
/*-----------------------------------------------------------------------------------------*/


/*-----------------------------------------------------------------------------------------*/
/*              */
/*-----------------------------------------------------------------------------------------*/



