﻿var viewportwidth;
var viewportheight;

$(document).ready(function() {
	findDimensions();

	$('#GlobalHeader').css({ 'height': viewportheight });

	$(window).bind("resize", resizeWindow);

	function resizeWindow(e) {
		findDimensions();

		$('#GlobalHeader').css({ 'height': viewportheight });
	}
	
	switch(window.location.hash) {
	    case "#menu=0,679,-1":
	        window.location = "/en/us/company-info/legal/privacy-policy.html";
	        break;
	    case "#menu=0,678,-1":
	        window.location = "/en/us/company-info/legal/index.html";
	        break;
	}
});

function slideSite(urlPath, target) {
    try{
        //dcsMultiTrack('DCS.dcsuri', 'ui/slidenavClicked', 'DCSext.hp_linkto', urlPath);
        pageTracker._trackEvent(CulturePrefix + 'tile_navigation', 'tile_click', 'tile/' + document.title.trim() + urlPath.trim());
    }
    catch(e){}
	var browserWidth = viewportwidth;
	var slideTime = 300;
	var hangTime = 50;
	var leftAdjust = ((browserWidth - 860) / 2) + 860;
	
	if(target == "_blank"){
		window.open(urlPath);
	}else{
	
		$('#MenuTab').show();
		$('#GlobalHeader').animate(
		{ left: -leftAdjust },
		slideTime,
		'easeOutSine',
		function() {
			window.location = urlPath;
		});
	}
}

function findDimensions() {
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerWidth,
					viewportheight = window.innerHeight
	} else if (typeof document.documentElement != 'undefined'
						&& typeof document.documentElement.clientWidth != 'undefined'
						&& document.documentElement.clientWidth != 0) {
		viewportwidth = document.documentElement.clientWidth,
					viewportheight = document.documentElement.clientHeight
	} else {
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
					viewportheight = document.getElementsByTagName('body')[0].clientHeight
	}
}

function addFlashUpgradeMessage() {
	$('body').prepend('<div id="NoFlashUpgrade"><p>BK.com is optimized for best use with Flash Player 10. Please Upgrade. <a href="http://www.adobe.com/products/flashplayer/" class="utility" target="_blank">Download the latest Flash Player &gt;</a></p></div>');
}
