function index() {};
index.prototype.init = function () {
  try  {
    // Highlighting navigation section
    var page = as.info.page || "home";
    var obj = as.yui.one("#navId"+page);
    if (obj) obj.addClass("selected");    
    
    // Setup onclick function
    as.yui.one("#btnGlobalSearch").on('click', function(e) { 
      var value = as.yui.one("#inpGlobalSearch").get("value");
      if (value) {
        var items = as.yui.one("#inpGlobalSearchType");      
        var type = null;
	    items.get("options").each(function () {
	  		if (this.get("selected")) {
	  		  type = this.get("value");
	  		};
	  	});      
        value = value.replace(/ /gi, "-");
        window.location.href = "/studio/search/"+type+"/"+encodeURI(value)+".htm";
      };
    });
    
    // Default onmouse-over / out functions
    as.global.onmouseover = this.onmouseover;
    as.global.onmouseout = this.onmouseout;
    as.global.onclick = this.onclick;
    
    //this.initFacebook();
  } catch(e) {
    as.logs.addError(this.getFilename(), "'init' >>"+e);
  };
};

index.prototype.initFacebook = function() {
  try {  
	FB.ensureInit(function () {
	 FB.Connect.get_status().waitUntilReady(function(status) {
	   var div = as.yui.one("#divFBConnect");
	   switch(status) {
	     case FB.ConnectState.connected:
	       div.setContent("<span class='title'>Welcome </span><fb:name uid='loggedinuser' useyou='false' linked='true'></fb:name>");
	       break;
	     case FB.ConnectState.appNotAuthorized:
	       
	       break;
	     case FB.ConnectState.userNotLoggedIn:
	       div.setContent("<fb:login-button v=\"2\" size=\"medium\" onlogin=\"as.corex.getApplet('index').loggedIn();\">Connect with Facebook</fb:login-button>"); 
	       break;
	   }
	 });
	});  		
  } catch(e) {
    
  };
};

index.prototype.loggedIn = function() {
  alert("logged in reload");
};

index.prototype.onmouseover = function(el, cl) { el.className = cl+" highlight"; };
index.prototype.onmouseout = function(el, cl) {el.className = cl; };
index.prototype.onclick = function(url) { if (url) window.location.href = url; };