﻿<!--START: MainNav -->
$(document).ready(function() {
	var isIE = false;
	var version = false;
	var is7 = false;
	jQuery.each(jQuery.browser, function(i, val) {
     
		if ((i == "msie") && (val == true))
		{
			isIE = true;
		}else if ((i == "version") && (val == "7.0"))
		{
			version = true;
		}
    });
	if (isIE && version)
    {
	//	alert("it is IE 7");
		is7 = true;
    }else{
		//alert("it is not IE 7");
		
	}
	var smArray = new Array();
	$('.header').css('border-bottom','3px solid #ec008c');
	//$('.mainContent').hide();
	//alert($('.sm1').find('li').length);
	for(var i=1; i<=7; i++)
	{
		//alert($('.m' + i).find('div').length);
		if ($('.m' + i).find('div').length == 1){}
		tempW = 0;
		temp = $('.sm' + i).find('li').length;
		if (temp > 0)
		{
			smArray[i] = 1;
		}
		for(var j=0; j<temp; j++)
		{
			tempW +=  $('.sm' + i).find('li:eq('+j+') a').width();
			//alert(tempW)
		}
		$('.sm' + i).css('width',tempW);
	}
	
	$('.mainNav li > div').hide();
	$('.submenuArea').hide();
	$('.mainNav > ul > li > a').bind({
	  
	  click: function() {
	  },
	  mouseenter: function() {
		  $('.mainNav a').removeClass('highlight');
		  $(this).addClass('highlight');
			if ( smArray[$(this).parent().index() + 1] == 1){
				$('.submenuArea').show();
				$('.submenu_bg').show();
				if (is7){
					$('.mainNav').css('padding-bottom','36px');
				} else{
					$('.header').css('border-bottom','0px');
				}
				//alert('yman');
			} else{
				//alert('yman2');
				$('.submenuArea').hide();
				$('.submenu_bg').hide();
				if (is7){
					$('.mainNav').css('padding-bottom','0px');
				} else{
					$('.header').css('border-bottom','3px solid #ec008c');
				}
		 		
			}
		  $(this).parent().parent().find('div').hide();
		  $(this).parent().find('div').show();
	  },
	  mouseleave: function() {
	  }
	});
	
	
	$('.mainNav').bind({
	  mouseleave: function() {
		$('.header').css('border-bottom','3px solid #ec008c');
		$('.mainNav a').removeClass('highlight');
		$('.mainNav li div').hide();
		$('.submenuArea').hide();
		$('.submenu_bg').hide();
		if (is7){
			$('.mainNav').css('padding-bottom','0px');
		}
		navActiviate();
	  }
	});
	
	navActiviate();
});
<!-- END: MainNav -->


function navActiviate(){
	
	if(window.location.href.indexOf("/html/hkss/")>0){
		$('.mainNav li.m1 > a').addClass('highlight');
	}
	if(window.location.href.indexOf("/html/shopping/")>0){
		$('.mainNav li.m2 > a').addClass('highlight');
	}
	if(window.location.href.indexOf("/html/dragonboat/")>0){
		$('.mainNav li.m3 > a').addClass('highlight');
	}

	
}



function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function chLang(lang) {
	var link = parent.parent.location.href;
	var endLink = link.length;
	var i;
	var n;
	var found = 0;
	
	for(i = 0; i <= endLink; i++) {
		n = i + 4;
		if (link.substring(i, n) == "/eng") {
			chLink = link.substring(0, i)+ '/' + lang + link.substring(n, endLink);
			break;
		}
		else if (link.substring(i, n) == "/tc/") {
			chLink = link.substring(0, i)+ '/' + lang + '/' + link.substring(n, endLink);
			break;
		}
		else if (link.substring(i, n) == "/sc/") {
			chLink = link.substring(0, i)+ '/' + lang + '/' + link.substring(n, endLink);
			break;
		}
	}
	//alert(lang);
	parent.parent.location.href = chLink;
}
/*	
	for(i = 0; i <= endLink; i++) {
		n = i + 4;
		if (link.substring(i, n) == "/eng") {
			if (target == 2) {
				chLinkeng = link.substring(0, i) + "/tc" + link.substring(n, endLink);
				parent.location.href = chLinkeng;
			} else if (target == 3) {
				chLinkeng = link.substring(0, i) + "/sc" + link.substring(n, endLink);
				parent.location.href = chLinkeng;
			}
			break;
		} else if (link.substring(i, n) == "/tc/") {			
			if (target == 1) {
				chLinkeng = link.substring(0, i) + "/eng/" + link.substring(n, endLink);
				parent.location.href = chLinkeng;
			} else if (target == 3) {
				chLinkeng = link.substring(0, i) + "/sc/" + link.substring(n, endLink);
				parent.location.href = chLinkeng;
			}
			break;
		} else if (link.substring(i, n) == "/sc/"){
			if (target == 1) {
				chLinkeng = link.substring(0, i) + "/eng/" + link.substring(n, endLink);
				parent.location.href = chLinkeng;
			} else if (target == 2) {
				chLinkeng = link.substring(0, i) + "/tc/" + link.substring(n, endLink);
				parent.location.href = chLinkeng;
			}
			break;
		} 
	}*/



function go(page) {
	if (page != 0)
		self.location.href = page;
}

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_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_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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



function header() {
document.writeln('<div class="posRel" style="width:960px; margin:0px auto; padding:0px 25px;">');
document.writeln('<div class="posAbs" style="z-index:500; _z-index:9;">');
document.writeln('<div class="header">');
document.writeln('<div class="lang">');
document.writeln('<ul>');
document.writeln('<li class="btn1"><a href="../front/index.html">home</a></li>');
document.writeln('<li class="mL8 mR8 pT3">|</li>');
document.writeln('<li class="btn2"><a href="javascript:chLang(\'tc\');">tc</a></li>');
document.writeln('<li class="mL8 mR8 pT3">|</li>');
document.writeln('<li class="btn3"><a href="javascript:chLang(\'sc\');">sc</a></li>');
document.writeln('</ul>');
document.writeln('</div>');
document.writeln('<div class="mainNav">');
document.writeln('<ul>');
document.writeln('<li class="m1"><a href="../hkss/index.html">HKSS</a></li>');
document.writeln('<li class="m2 posRel">');
document.writeln('<a href="../shopping/index.html">Triple Your Shopping Fun with Visa</a></li>');
document.writeln('<li class="m3 posRel">');;
document.writeln('<a href="../dragonboat/index.html">Hong Kong Dragon Boat Carnival</a></li>');


document.writeln('</ul>');
document.writeln('</div>');
document.writeln('</div>');
document.writeln('</div>');
document.writeln('</div>');
}

function footer() {
document.writeln('<div class="footer posRel" style="z-index:20; _margin-top:75px;">');
document.writeln('<div class="posAbs" style="top:-145px; right:-30px; _z-index:10; display:none; _display:block;"><img src="../../images/common/img_BVisual.jpg" /></div>');
document.writeln("<div class=\"tnc fL w650\">Copyright&copy;2011 Hong Kong Tourism Board<br>");
document.writeln("This site is best viewed with: resolution 1024x768; IE 7.0 and IE 8.0 \/ Firefox 3.0 or above; Flash Player 9.0 or above.<br>");
document.writeln("<a href=\"http://www.discoverhongkong.com/eng/misc/privacy-policy-index.html\" target=\"_blank\">Privacy Policy<\/a> | <a href=\"http://www.discoverhongkong.com/eng/misc/terms-of-use.html\" target=\"_blank\">Terms of Use<\/a> | <a href=\"http://www.discoverhongkong.com/eng/misc/contact-us.html\" target=\"_blank\">Contact Us<\/a> | <a href=\"http://www.discoverhongkong.com/eng/interactive/e-newsletter.html\" target=\"_blank\">e-Newsletter<\/a><\/div>");
document.writeln("<div class=\"fR mL18\"><a href=\"http://www.brandhk.gov.hk/en\"  target=\"_blank\"><img src=\"..\/..\/images\/common\/img_footer1.gif\" \/><\/a><\/div>");
document.writeln("<div class=\"fR\"><a href=\"http://www.discoverhongkong.com/eng//\"  target=\"_blank\"><img src=\"..\/..\/images\/common\/img_footer2.gif\" \/><\/a><\/div>");
document.writeln("<\/div>");
}

function footer2() {
document.writeln('<div class="footer">');
document.writeln("<div class=\"tnc fL w650\">Copyright&copy;2011 Hong Kong Tourism Board<br>");
document.writeln("This site is best viewed with: resolution 1024x768; IE 7.0 and IE 8.0 \/ Firefox 3.0 or above; Flash Player 9.0 or above.<br>");
document.writeln("<a href=\"http://www.discoverhongkong.com/eng/misc/privacy-policy-index.html\" target=\"_blank\">Privacy Policy<\/a> | <a href=\"http://www.discoverhongkong.com/eng/misc/terms-of-use.html\" target=\"_blank\">Terms of Use<\/a> | <a href=\"http://www.discoverhongkong.com/eng/misc/contact-us.html\" target=\"_blank\">Contact Us<\/a> | <a href=\"http://www.discoverhongkong.com/eng/interactive/e-newsletter.html\" target=\"_blank\">e-Newsletter<\/a><\/div>");
document.writeln("<div class=\"fR mL18\"><a href=\"http://www.brandhk.gov.hk/en\"  target=\"_blank\"><img src=\"..\/..\/images\/common\/img_footer1.gif\" \/><\/a><\/div>");
document.writeln("<div class=\"fR\"><a href=\"http://www.discoverhongkong.com/eng//\"  target=\"_blank\"><img src=\"..\/..\/images\/common\/img_footer2.gif\" \/><\/a><\/div>");
document.writeln("<\/div>");
}


function sharebar() {

document.writeln("					<script type=\"text/javascript\">    ");
document.writeln("						var addthis_config = {     ");
document.writeln("							services_exclude: \"digg,delicious,reddit\",       ");
document.writeln("							data_ga_tracker: null,       ");
document.writeln("							data_track_clickback: true,       ");
document.writeln("							services_custom: [");
document.writeln("								{	name: \"Sina WeiBo\",");
document.writeln("									url: \"http://v.t.sina.com.cn/share/share.php?url={{url}}&title={{title}}\"");
document.writeln("									,icon: \"../../images/common/icon_05.gif\"     ");
document.writeln("								},");
document.writeln("								{	name: \"RenRen\",        ");
document.writeln("									url: \"http://share.renren.com/share/buttonshare.do?link={{url}}&title={{title}}\"");
document.writeln("									,icon: \"../../images/common/icon_02.gif\" ");
document.writeln("								},      ");
document.writeln("								{	name: \"Kaixin001\",        ");
document.writeln("									url: \"http://www.kaixin001.com/repaste/share.php?rurl={{url}}&rtitle={{title}}\"");
document.writeln("									,icon: \"../../images/common/icon_03.gif\"      ");
document.writeln("								}");
document.writeln("							]  ");  
document.writeln("						};");
document.writeln("					</script>");
document.writeln("					<div class=\"addthis_toolbox float_l share_div\">");
document.writeln("						<img src=\"../../images/common/img_shareTo.gif\" />");
document.writeln("						<a class=\"addthis_button_facebook\" style=\"margin-left:0px;\" href=\"#\"><img src=\"../../images/common/icon_01.gif\" /></a>");
document.writeln("						<a class=\"addthis_button_share.renren.com\" href=\"#\"><img src=\"../../images/common/icon_02.gif\" /></a>");
document.writeln("						<a class=\"addthis_button_www.kaixin001.com\" href=\"#\"><img src=\"../../images/common/icon_03.gif\" /></a>");
document.writeln("						<a class=\"addthis_button_twitter\" href=\"#\"><img src=\"../../images/common/icon_04.gif\" /></a>");
document.writeln("						<a class=\"addthis_button_v.t.sina.com.cn\" href=\"#\"><img src=\"../../images/common/icon_05.gif\" /></a>");
document.writeln("						<a class=\"addthis_button_compact\" href=\"#\"><img src=\"../../images/common/icon_06.gif\" /></a>");
document.writeln("					</div>");
document.writeln("					<div class=\"clear\"></div>");
document.writeln("					<script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#username=hktb\"></script>");

//document.writeln(" <ul>");
//document.writeln("<li class=\"fL\"><img src=\"../../images/common/img_shareTo.gif\" /></li>");
//document.writeln("<li class=\"mL8 icon fL\"><img src=\"../../images/common/icon_01.gif\" /></li>");
//document.writeln("<li class=\"mL8 icon fL\"><img src=\"../../images/common/icon_02.gif\" /></li>");
//document.writeln("<li class=\"mL8 icon fL\"><img src=\"../../images/common/icon_03.gif\" /></li>");
//document.writeln("<li class=\"mL8 icon fL\"><img src=\"../../images/common/icon_04.gif\" /></li>");
//document.writeln("<li class=\"mL8 icon fL\"><img src=\"../../images/common/icon_05.gif\" /></li>");
//document.writeln("<li class=\"mL8 icon fL\"><img src=\"../../images/common/icon_06.gif\" /></li>");
//document.writeln("</ul>");
}



