// Only include dojo files if dojo is defined for this page
if (typeof(dojo)!="undefined")
{
	dojo.require("dojo.io.*");
	dojo.require("dojo.io.ScriptSrcIO");
}

// JavaScript Document
function changeCSSClass(id, newClass, h) {

	if (newClass != "#"){
		identity=document.getElementById(id);
		identity.className=newClass;
		
		//navContainer = document.getElementById('nav_container');
		if (h == '125'){
			document.getElementById('nav_container').style.height='125px';
		}else{
			document.getElementById('nav_container').style.height='205px';
		}

	}
}

function sfHover() {
	var sfEls = new Array(document.getElementById('nav_categories'),document.getElementById('nav_diy'),document.getElementById('nav_notebook'),document.getElementById('nav_faqs'),document.getElementById('nav_contactus'))
	for (var i=0; i<sfEls.length; i++) {
		if (sfEls[i] == null) continue;
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}



if (window.attachEvent) window.attachEvent("onload", sfHover);

imgArr1=new Array(); 
imgArr1=new Array('images/check_on.gif','images/check_off.gif'); 
function swap1(chk,ind){ 
    img=document.images['img'+ind]; 
    if(chk == 1){ 
        img.src=imgArr1[1]; 
        document.getElementById('imageCheck' + ind).value = 0;
    } 
    else{ 
        img.src=imgArr1[0]; 
        document.getElementById('imageCheck' + ind).value = 1;
    } 
} 


function navNotebookAction () {
dojo.io.bind({
	url: "LoginManager",
    preventCache: true,
	transport: "ScriptSrcTransport",
	checkString: "json",
    mimetype: "application/json",
    content: {
		action: "check"
	},
    load: function(type, data, event, kwArgs) { navNotebookSuccess (json); },
	error: function(type, data, event, kwArgs) { /*alert ('error');*/ },
	timeout: function() { alert ('timeout');},
	timeoutSeconds: 30 //The number of seconds to wait until firing timeout callback in case of timeout.

});

}
function navNotebookSuccess (json) {
	//alert("Success: " + json.status);
	if (json.status == "error") {
		alert("Server Error");
	} else if (json.status == "nologin") {
        var bn=navigator.appName; 
        if (bn == "Microsoft Internet Explorer") {
			show('signIn');
    		//TB_show("Login", "notebook_tb_login.jsp?langId=" + langId + "&redirect=notebook.jsp&width=256&height=114&TB_iframe=true", false);
        }
        else {
			show('signIn');
    		//TB_show("Login", "notebook_tb_login.jsp?langId=" + langId + "&redirect=notebook.jsp&width=285&height=120&TB_iframe=true", false);
        }
	} else if (json.status == "loggedin") {
		window.location = "notebook.jsp";
	}
}
function navNotebookError(xhttp) {
	alert("Request Error");
}
