    /* If not using firebug, define console and make log a NOOP */
    if (typeof console == 'undefined') {
            var console = {};
            console.log = function(msg) {
                    return;
            };
    }
	jQuery = jQuery.noConflict();
	
	/* Show/Hide lost password */
    function toggle_visibility(id1,id2) {
       var e1 = document.getElementById(id1);
	   var e2 = document.getElementById(id2);
       if(e1.style.display == 'block')
	   {
          e1.style.display = 'none';
		  e2.style.display = 'block';
	   }
       else
	   {
          e1.style.display = 'block';
		  e2.style.display = 'none';
	   }
    }
	
	/* Highlights login box to user 
	function focusLogin()
	{
		var inputuser = document.getElementById('player');
		inputuser.style.backgroundColor = '#FF0';
		inputuser.focus();
	}*/

    /* If we support jQuery, make default inside torn frame */
    jQuery(document).ready(function(){
      if (window.location.hash == '#noframe') {
        console.log ("Frame disabled");
        jQuery.cookie("mode", "noframe");
      } else {
        /* If we support jquery, let the user change. IF we dont, the form will submit as no chat as above will not execute */
        html = '<p>Login to <a href="#" onclick="javascript: mobileview();" id="view_mobile">Mobile</a><a href="#" onclick="javascript: fullview();" id="view_full">Full</a> Torn</p>';
		jQuery("#experience").html(html);
		//alert(jQuery.cookie("mode"));
		// If no cookie or cookie is fullmode AND ALSO not on mobile page
		// OR...
		// If on mobile page and user selects fullmode
		// *set full mode*
		if ((jQuery.cookie("mode") == null || jQuery.cookie("mode") == 'full') && (location.pathname != '/mobile/'))
		{
			fullview();
		}
		else
		{
			mobileview();
		}
		//alert(jQuery.cookie("mode"));
      }
    });
    
    /* For mobile view, put the target=_top attr back for the form and put the full link in case the user changes mind */
    function mobileview() {
      jQuery("#login").attr("target", "_top");
      jQuery("#view_mobile").hide();
      jQuery("#view_full").show();
      jQuery.cookie("mode", "mobile", {path: '/'});
    }
	
    /* For full view, remove the target attribute from the form and put the mobile link in case user changes mind */
    function fullview() {
      jQuery("#login").removeAttr("target");
      jQuery("#view_mobile").show();
      jQuery("#view_full").hide();
      jQuery.cookie("mode", "full", {path: '/'});
    }
