	function getUrlVar(requestedKey) {
		var vars = [], hash;
		var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

		for (var i = 0; i < hashes.length; i++) {
			hash = hashes[i].split('=');
			vars.push(hash[0]);
			vars[hash[0]] = hash[1];
		}
		if (typeof requestedKey == 'undefined') {
			return vars;
		} else {
			return vars[requestedKey];
		}
	}

	var environment = "production";
    var url = window.location.href;

		if (url.indexOf("staging") > -1)
	    {
	        environment = "staging";
	    }else if (url.indexOf("prewin") > -1)
		{
			environment = "development";
		}else if (url.indexOf("192.168.6.25") > -1 || url.indexOf("shackletondigital") > -1)
	    {
	        environment = "developmentBalanced";
	    }

	    var params = {
	        quality: "high",
	        scale: "noscale",
	        allowscriptaccess: "always",
	        menu: 'false'
	        //bgcolor: "#FFFFFF"
	    };
	    var flashvars = {
	        domain: '*',
	        environment: environment
	    };
	    var attributes = {
	        id: "flashcontent",
	        name: "flashcontent"
	    };
		
		
		/********************************
		*	CHECK FLASH PLAYER VERSION 	*
		*********************************/
		// has Flash
		if (swfobject.hasFlashPlayerVersion("10")) {
		  swfobject.embedSWF('jb_container.swf', 'JBCorporativa', '100%', '100%', '10', 'js/expressinstall.swf', flashvars, params, attributes);
		}
		else {
		  // no Flash
		  swfobject.embedSWF('jb_container.swf', 'JBCorporativa', '100%', '100%', '10', 'js/expressinstall.swf', flashvars, params, attributes);
		  $('#JBCorporativa').css('display', 'block');
		}
	    

	    //var url = '<%= Request.QueryString["url"] %>';
		var url = getUrlVar("url");

		if (typeof(url) != 'undefined')
		{
			var pos = window.location.href.indexOf("?");

			var SWFAddressURL = decodeURIComponent(window.location.href.substring(pos + 5));
			SWFAddressURL = SWFAddressURL.replace(/\+/gi,' ');
			var newUrl = window.location.href.substr(0, pos) + "#/" + SWFAddressURL;

	        //var newUrl = window.location.href.substr(0, pos) + "#/" + decodeURIComponent(window.location.href.substring(pos + 5));
	        window.location.href = newUrl;
		}

	    function fbShare(url) {
	        window.open('http://www.facebook.com/sharer.php?u=' + url, 'sharer', 'toolbar=0,status=0,width=625,height=435');
	    }

	    function registrarEnlace(evento, seccion, link) {
	        try {
	            pageTracker._trackEvent(evento, seccion, link);
	        } catch (err) {
	            //alert(err);
	        }
	    }




					var i = 0;


		            /*
		            FB.Event.subscribe("auth.login", function(response) {
						alert(response.session.access_token);
		                window.location.reload();
		            });
		            */

		            /*
		            $(function() {
						$("#login").click(function() {
							FB.getLoginStatus(function(response) {
								if (response.session)
								{
									alert("login: " + response.session.access_token);
								}
								else
								{
									FB.login();
								}
							});

							return false;
						});
		            });
		            */
					function initFB()
		            {
							FB.init({
						        appId: "120807784611488",
						        status: false,
						        xfbml: true,
						        cookie: false
						    });
					}
		            function startLoginJS()
		            {	
						FB.login(checkLoginJS, {perms:'user_photos,user_photo_video_tags'});
					}
					function checkLoginJS()
			        {
		            	FB.getLoginStatus(function(response) {

							if (response.session)
							{
								document.getElementById("flashcontent").checkLoginAS(response.session.access_token);						
							}
							else
							{
								document.getElementById("flashcontent").checkLoginASError(response.session.access_token);
							}
						});
		            }
	

// IE FIXES 				

	if ( $.browser.msie && parseInt(jQuery.browser.version) <= 7 ) {

		$(window).resize( resizeForIE );
		$(document).ready( resizeForIE );
		
	}	
	
	function resizeForIE() 
	{ 
		if ($(window).width() > 1016)
			$("#flashcontent").width( $(window).width() );
		else
			$("#flashcontent").width( 1016 );
		
		if ($(window).height() > 626){
			$("#flashcontent").height( $(window).height() );
			$("html").css( "overflowY", "hidden" );
		} else	{
			$("#flashcontent").height( 626 );
			$("html").css( "overflowY", "auto" );
		}
	}

