//Allows 2 seperate links (image and text) to start Lightbox gallery without a duplicate 1st image.
function lightBoxLink(){
	document.getElementById('link2').onclick()
}



// bookmark this page
function addBookmark()
{
	var bookmarkurl = window.location;
	var bookmarktitle = document.title;
	if (document.all)
		window.external.AddFavorite(bookmarkurl,bookmarktitle)
}


// print page
function printPage()
{
	window.print();
}


// button links
function goToBookingEngine()
{ 
	//window.location = ''; 
}


// gallery
function OpenWindow(image){
	
	var width = 520;
	var height = 350;
	
	var leftPos = (screen.availWidth - width) / 2;
	var topPos = (screen.availHeight - height) / 2;
	
	window.open("/Gallery_Popup.html?image="+image,"libraryWindow","toolbar=no,location=no,scrollbars=yes,resizable=yes,width="+width+",height="+height+",left="+leftPos+",top="+topPos);
}

function addOnloadEvent(fnc){
  if ( typeof window.addEventListener != "undefined" )
    window.addEventListener( "load", fnc, false );
  else if ( typeof window.attachEvent != "undefined" ) {
    window.attachEvent( "onload", fnc );
  }
  else {
    if ( window.onload != null ) {
      var oldOnload = window.onload;
      window.onload = function ( e ) {
        oldOnload( e );
        window[fnc]();
      };
    }
    else
      window.onload = fnc;
  }
}


function showSubMenu(num){
	var uls = document.getElementById('menu').getElementsByTagName('ul');
	if( num <= uls.length){
			for (var i=0; i<uls.length; i++) {
				if(i == num){
					uls[i].className = "show";
				}else{
					uls[i].className = "hide";
				}
			}							
	}
	if(num == 999){
			for (var i=0; i<uls.length; i++) {
					uls[i].className = "show";
			}		
	}
	if(num > uls.length && num != 999){
			for (var i=0; i<uls.length; i++) {
					uls[i].className = "hide";
			}			
	}
}

jQuery(document).ready(function () {
  jQuery("a[href*='globekey.com/'],a[href*='key-res.com/'],a[href*='skchase.com/']").click(function() {
        _gaq.push(['_link', this.href]);
        return false;
    });
  jQuery('a[href$=".pdf"]').click(function() {
        _gaq.push(['_trackEvent', 'Downloads', 'PDF', '/pdf/'+this.href, 1]);
    });
  jQuery('a[href^="mailto:"]').click(function() {
        _gaq.push(['_trackEvent', 'Email', 'Link', '/mailto/'+this.href, 1]);
    });
  jQuery("a[href^='http']:not([href*='skchase.com'],[href*='globekey.com'],[href*='easy-breaks.com'],[href*='key-res.com/'])").click(function() {
        _gaq.push(['_trackEvent', 'External', 'Link', '/external/'+this.href, 1]);
    });
  jQuery('form[action^="http:"][method="post"]').submit(function() {
        _gaq.push(['_linkByPost', this]);
    });
});

// wrap the A tag on links in left column just before the "-" on Google Map template.
jQuery(document).ready(function() {
	jQuery("#content-wrapper-map #left-col ul li h3 a").each(function(index){
		jQuery(this).html(jQuery(this).html().replace("-", "<br />-")); 
	});

	jQuery("#left-col #sub-menu ul li a").each(function(index){
		jQuery(this).html(jQuery(this).html().replace("-", "<br />-")); 
	});
});

 







