function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

//$(document).ready(function(){
//	$('.latestnews-holder div.latestnews:last').addClass('bordernewsnone');
//});

function addclassbg(divID) { $("#" + divID).addClass('addbg'); }
function removeclassbg(divID) { $("#" + divID).removeClass('addbg'); }

function toggleBlock(div_id,maximum){
	var d = MM_findObj('exchangeBox'+div_id);
	for(var i=1;i<=maximum;i++){
		MM_findObj('exchangeBox'+i).style.display="none";
		}
	if(d != null){
		if(d.style.display == "block"){
			d.style.display = "none";
		} else {
			d.style.display = "block";
		}
	}
}
//***************  Added 28/01/2010 *******************************
function ValidateOtherSearch(source, args) {
    var url = document.location.href.toLowerCase();
    if (url.indexOf("default") > -1) {
        if (MM_findObj("ucHeader1_txtKeyword").value == "" || MM_findObj("ucHeader1_txtKeyword").value == "Search..." || MM_findObj('ucHeader1_txtKeyword').value.length < 4)
            args.IsValid = false;
        else
            args.IsValid = true;
    }
    else {
        if (MM_findObj("ctl00_ucHeader1_txtKeyword").value == "" || MM_findObj("ctl00_ucHeader1_txtKeyword").value == "Search..." || MM_findObj('ctl00_ucHeader1_txtKeyword').value.length < 4)
            args.IsValid = false;
        else
            args.IsValid = true;
    }
}
function ResetForm() {
    document.aspnetForm.reset();
    return false;
}
function gototop() { $('#anchor1').click() }
function ShowHidelist(listname, showhide) {
    MM_findObj(listname).style.display = showhide;
}

/**************send to a friend*****************/
$(document).ready(function(){
$('.send-mail').css('visibility','visible');
$("#slideMail").hide();
$("a#mailBtn").click(function () {
  if ($("#slideMail").is(":hidden")) {
	$("#slideMail").slideDown("slow");
  } else {
	$("#slideMail").slideUp();
  }
});
$("#closeMail").click(function(){
	$("#slideMail").slideUp();							   
})
});
/*******************************************/


/*****************Enlarge Font**************************/
var max_font_size = 18;
var min_font_size = 10;

$(function(){
	$('a.controls').click(function(){
		var ourText = $('.main-content, .main-content td').not(".more a");
		var currFontSize = ourText.css('fontSize');
		var finalNum = parseFloat(currFontSize, 12);
		var stringEnding = currFontSize.slice(-2);
		if(this.id == 'large') {
			if(finalNum < max_font_size) finalNum += 2;
		}
		else if (this.id == 'small'){
			if(finalNum > min_font_size) finalNum -=2;
		}
		ourText.css('fontSize', finalNum + stringEnding);
	});
});
/**************Enlarge Font***************************/

/**************Print****************/
function print_function(style, flashvar1, flashvar2,eventID) {
    var disp_setting = "toolbar=no,location=no,directories=no,menubar=no,";
    disp_setting += "scrollbars=yes,width=740, height=450, left=100, top=100";
    var content_value = document.getElementById("printarea").innerHTML;
    var docprint = window.open("", "", disp_setting); docprint.document.open();
    docprint.document.write('<html><link rel="stylesheet" type="text/css" href="' + style + '" /><link href="../../RadHS/Grid.RadHS.css" rel="stylesheet" type="text/css" /><link href="../../RadHS/Input.RadHS.css" rel="stylesheet" type="text/css" /><link href="../../RadHS/ComboBox.RadHS.css" rel="stylesheet" type="text/css" /><head><title>Horeca</title></head><body><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><div style="background:#fff;"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="header"><tr><td><img alt="hospitality services" src="../../Admin/DynamicImage.aspx?PHID=99&PageID=' + eventID + '&Published=1"></td><td style="padding:15px 0 0 0;"><a href="javascript:;" onclick="javascript:self.print(); javascript:self.close();" style="color:#c4c4c4;">Print</a></td></tr></table></div><div></div><div style="background:#FFF; padding:10px 10px 10px 10px;">');
    docprint.document.write('<object id="FlashID3" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="28"><param name="movie" value="swf/main-title-sub.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="flashvars" value="' + flashvar1 + '"/><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="Scripts/expressInstall.swf" /><object type="application/x-shockwave-flash" data="swf/main-title-sub.swf" width="600" height="28"><param name="flashvars" value="' + flashvar1 + '"/><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="Scripts/expressInstall.swf" /><div><h4>Content on this page requires a newer version of Adobe Flash Player.</h4><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p></div></object></object>');
  if (flashvar2 != "") { docprint.document.write('<object id="FlashID3" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="28"><param name="movie" value="swf/sub-title-sub.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="flashvars" value="' + flashvar2 + '"/><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="Scripts/expressInstall.swf" /><object type="application/x-shockwave-flash" data="swf/sub-title-sub.swf" width="600" height="28"><param name="flashvars" value="' + flashvar2 + '"/><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="swfversion" value="9.0.45.0" /><param name="expressinstall" value="Scripts/expressInstall.swf" /><div><h4>Content on this page requires a newer version of Adobe Flash Player.</h4><p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p></div></object></object>'); }
    docprint.document.write(content_value + '</div></td></tr></table></body></html>');
    docprint.document.close(); docprint.focus();
}
//function print_function(style) {
//    var disp_setting = "toolbar=no,location=no,directories=no,menubar=no,"; disp_setting += "scrollbars=yes,width=740, height=450, left=100, top=100"; var content_value = document.getElementById("printarea").innerHTML; var docprint = window.open("", "", disp_setting); docprint.document.open(); docprint.document.write('<html><link rel="stylesheet" type="text/css" href="' + style + '" /><link href="../../RadHS/Grid.RadHS.css" rel="stylesheet" type="text/css" /><link href="../../RadHS/Input.RadHS.css" rel="stylesheet" type="text/css" /><link href="../../RadHS/ComboBox.RadHS.css" rel="stylesheet" type="text/css" /><head><title>Horeca</title></head><body><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td><div style="background:#fff;"><table width="100%" border="0" cellspacing="0" cellpadding="0" class="header"><tr><td><img alt="hospitality services" src="images/logo.gif"></td><td style="padding:15px 0 0 0;"><a href="javascript:;" onclick="javascript:self.print(); javascript:self.close();" style="color:#c4c4c4;">Print</a></td></tr></table></div><div></div><div style="background:#FFF; padding:10px 10px 10px 10px;">' + content_value + '</div></td></tr></table></body></html>'); docprint.document.close(); docprint.focus();
//}
/***********************************/
function numeric(e) {
    return ((e.keyCode == 8) || (e.keyCode == 9) || (e.keyCode > 47 && e.keyCode < 58) || (e.keyCode > 95 && e.keyCode < 106));
}
/***********Events Calendar************/
//function ShowFulldata(id, PHid, DivID, thedate, therealdate) {
//    $("#" + DivID).html("<span>Loading...</span>");
//    $.get("GetEventInfo.aspx?ID=" + id + "&thedate=" + therealdate, '', function(data) { $("#" + DivID).html(data); });
//    var url = document.location.href.toLowerCase();
//    var txtbutton;
//    var hfsummary;
//    var hftitle;
//    var hftime;

//    if (url.indexOf("default") > -1) {
//        txtbutton = "ucCalendar1_lbtnAddToOutlook";
//        hfsummary = "ucCalendar1_hfSummary";
//        hftitle = "ucCalendar1_hfTitle";
//        hftime = "ucCalendar1_hfTime";
//        $("#ucCalendar1_hfDate").val(therealdate);
//    } else {
//   
//    txtbutton = "ctl00_ucCalendar1_lbtnAddToOutlook";
//    hfsummary = "ctl00_ucCalendar1_hfSummary";
//    hftitle = "ctl00_ucCalendar1_hfTitle";
//    hftime = "ctl00_ucCalendar1_hfTime";
//    $("#ctl00_ucCalendar1_hfDate").val(therealdate);
//}

//window.setTimeout(function() {
////   alert($("#divSummary").html());
//    //var x = "1"
//if ($("#divSummary").html()) {
//        $("#" + hfsummary).val($("#divSummary").html());
//        $("#" + hftitle).val($("#hlTitle").text());
//        $("#" + hftime).val($("#divTime").html());
//        $("#" + txtbutton).show("slow");
//    } else {
//        $("#" + txtbutton).hide("slow")
//    }
//}, 700);
//}
function ShowFulldata(id, PHid, DivID, thedate, therealdate,UseSubEvents) {
    $("#" + DivID).html("<span>Loading...</span>");
    var url = document.location.href.toLowerCase();
    if (url.indexOf("default") > -1) {
        $.get("GetEventInfo.aspx?ID=" + id + "&SubEvents=" + UseSubEvents + "&thedate=" + therealdate, '', function(data) { $("#" + DivID).html(data) });
       window.setTimeout(function() { $("#" + DivID).jScrollPane(); }, 2000);
    }
    else {
        $.get("GetEventInfo.aspx?ID=" + id + "&SubEvents=" + UseSubEvents + "&thedate=" + therealdate, '', function(data) { $("#" + DivID).html(data) });
    }
 }
$(document).ready(function(){$('.menu-holder a:last').css('padding-bottom',9)});

function CloseDiv(DivID) { $("#" + DivID).fadeOut("normal"); }
function showDiv(DivID) { 
	$("#" + DivID).show("normal"); 
}
function showDivCarousel(DivID) {
    $("#" + DivID).show("normal").jcarousel();
}

/**********Toggle***********/
$(document).ready(function(){
						   
	if ($.browser.msie && parseInt($.browser.version + "")<8){
		$('.menu-holder').css({'position':'relative','top': -3});
		//$('#gallery').css('height',289);
	}

if ($.browser.msie){
		//$('#gallery').css('height',289);
	}	
	$(".toggle_container").hide();

	$("a.trigger").toggle(function(){
		$(this).addClass("activeLink"); 
		}, function () {
		$(this).removeClass("activeLink");
	});
	
	$("a.trigger").click(function(){
		$(this).next(".toggle_container").slideToggle("slow,");
	});

});

/***Comments functions*/
function ShowCommentBox() {
    var n = MM_findObj('CommentBox');
    n.style.display = '';
}

function HideCommentBox() {
    var n = MM_findObj('CommentBox');
    n.style.display = 'none';
}

/*$(document).ready(function(){
	$('.relpos').hover(function(){
		$(this).find('div.showVote').show();
	},function(){
		$(this).find('div.showVote').hide();
	})
})*/
function changeRadioButtonSelection(rbtnConainer) {
    $("#" + rbtnConainer + " :radio").click(function(e) {
        $("#" + rbtnConainer + " :radio").removeAttr("checked");
        var clicked = $(e.target);
        clicked.attr("checked", "checked")
    });
}
function validateRadioButtonSelection(btn, rbtnConainer) {
    $("#" + btn).click(function(e) {
        var n = $("#" + rbtnConainer + " :radio:checked").length;
        if (n == 0) {
            alert("Please select an option");
            return false;
        }
    });

}
