/* =============================================================================================
   Print Content
 =============================================================================================== */		
	function printSiteContent(obj, title) {
		$('#frm_printContent input[name=printTitle]').val(title);
		$('#frm_printContent input[name=printContent]').val($(obj).html());
		$('#frm_printContent').submit();
		}

/* =============================================================================================
   Nav
 =============================================================================================== */
			$('.menuLv1 .item').hover(function (){
				if ($(this).hasClass('on')) {
					tmp = true;
				} else {
					tmp = false;
					$(this).addClass("on");
				} 
			},function (){
				if (!tmp) {
					$(this).removeClass('on');
				} 	
			});
			
/* =============================================================================================
   Calendar
 =============================================================================================== */
			$('.calendar .nav .tab').hover(function (){
				if ($(this).hasClass('on')) {
					tmp = true;
				} else {
					tmp = false;
					$(this).addClass("on");
				} 
			},function (){
				if (!tmp) {
					$(this).removeClass('on');
				} 	
			});		
			
			$('.calendar .nav .tab').click(function (){
				$('.calendar .desc').hide();
				
				$('.calendar .nav .tab').removeClass("on");
				$(this).addClass('on');
				tmp = true;
				tmp1 = $(this).hasClass('one');
				if (tmp1) {
					$('.calendar .desc.one').show();
				} else {
					$('.calendar .desc.two').show();
				}
			});		
			
		function viewCalendarDetail(id,type, title) {
			var data = 'id='+id+'&title='+title+'&type='+type;
			var randomnumber=Math.floor(Math.random()*1000000000);
				$.get(siteUrl+'/requests.php?siteFunction=getCalendarListData&randomNumber='+randomnumber, data , 
					function (result){
						$('#akBoxCalendarList .akBoxContentInner2').html(result);
						setAkBoxContent('akBoxCalendarList',760);		
					});	
			}			
			
	function toggleMonth(idMonth) {
		$('.groupMonth').hide();
		$('.m-'+idMonth).slideDown();
		}					

/* =============================================================================================
   Percorso
 =============================================================================================== */
			$('.tplPercorso .holeList .row').hover(function (){
				if ($(this).hasClass('on')) {
					tmp = true;
				} else {
					tmp = false;
					$(this).addClass("on");
					$(this).children().addClass("on");
				} 
			},function (){
				if (!tmp) {
					$(this).removeClass('on');
					$(this).children().removeClass("on");
				} 	
			});

		function viewHoleDetail(id) {
			var data = 'id='+id;
			$('.holeList .row').removeClass('on');
			var randomnumber=Math.floor(Math.random()*1000000000);
				$.get(siteUrl+'/requests.php?siteFunction=getHoleDetail&randomNumber='+randomnumber, data , 
					function (result){
						$('#akBoxHoleDetail .akBoxContentInner2').html(result);
						setAkBoxContent('akBoxHoleDetail',660);		
					});	
			}	

/* =============================================================================================
   Photogallery
 =============================================================================================== */

		function viewPhotogallery(id,tournament_id) {
			var data = 'id='+id+'&tournament_id='+tournament_id;
			var randomnumber=Math.floor(Math.random()*1000000000);
				$.get(siteUrl+'/requests.php?siteFunction=getPhotogalleryPictures&randomNumber='+randomnumber, data , 
					function (result){
						$('#akBoxPhotogallery .akBoxContentInner2').html(result);
						setAkBoxContent('akBoxPhotogallery',703);		
					});	
			}	

/* =============================================================================================
   Banner
 =============================================================================================== */			
			$('#template .banner').fadeIn(1500);

/* =============================================================================================
   AkBox 
 =============================================================================================== */			
			var AkBoxWidth = 760;
			
			function obscureScreen2(){
				if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
					$("body","html").css({height: "100%", width: "100%"});
					$("html").css("overflow","hidden");
			
					if (document.getElementById("akBoxHideSelect2") === null) {//iframe to hide select elements in ie6
						$("body").append("<iframe id='akBoxHideSelect2'></iframe><div id='akBoxOverlay2'></div>");
					}
				} else {//all others
					if(document.getElementById("akBoxOverlay2") === null){
						$("body").append("<div id='akBoxOverlay2'></div>");
					}
				}
			
				overlay = $('#akBoxOverlay2');
		
				if(detectMacXFF2()){
					overlay.addClass("akBoxOverlayMacFFBGHack2");//use png overlay so hide flash
				} else {
					overlay.addClass("akBoxOverlayBg2");//use background and opacity
				}
			}
		
			function detectMacXFF2() {
				var userAgent = navigator.userAgent.toLowerCase();
				if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
			 	return true;
				}
			}

			function openAkBox2(AkBoxWidth){
				obscureScreen2();
				if($.browser.msie && $.browser.version == 6){
					p = $('#akBoxWindow2').offset();
					$('#akBoxWindow2').css('top',document.documentElement.scrollTop);
				}
				$('#akBoxWindow2').css({marginLeft: '-' + parseInt((AkBoxWidth / 2),10) + 'px'/*, width: width + 'px'*/}).show();
			}
			
			function closeAkBox2(){
				$('#akBoxWindow2').fadeOut("fast",function(){
					$('#akBoxOverlay2,#akBoxHideSelect2').trigger("unload").unbind().remove();
					$('#akBoxWindow2').hide();
				});
			
				if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
					$("body","html").css({height: "auto", width: "auto"});
					$("html").css("overflow","");
				}
			}
			
	
			function setAkBoxContent(ctn,w) { 
			 $('.akBoxContentInner1').hide();
				$('#'+ctn).fadeIn(1500);
				openAkBox2(w);
				
				
				if (ctn == 'akBoxHoleDetail') {
					$('#akBoxWindow2').css('width',657);
				} else if (ctn == 'akBoxPhotogallery') { 
				 $('#akBoxWindow2').css('width',703);
				} else {
				 $('#akBoxWindow2').css('width',754);
				}
		 }


	



