// JavaScript Document for pimrii

function showAddCollection(id) {
	if(document.getElementById && document.getElementById(id).style.display == 'block') {
		document.getElementById(id).style.display = 'none';
		document.getElementById('img_'+id).src = "/resources/button_tiny_plus.gif";
	}
	else if (document.getElementById && (document.getElementById(id).style.display == 'none' || document.getElementById(id).style.display == '') ){
		document.getElementById(id).style.display = 'block';
		document.getElementById('img_'+id).src = "/resources/button_tiny_close.gif";
	}
}
function showRenameCollection(id) {
	if(document.getElementById && document.getElementById(id).style.display == 'block') {
		document.getElementById(id).style.display = 'none';
		document.getElementById('img_'+id).src = "/resources/button_tiny_open.gif";
	}
	else if (document.getElementById && (document.getElementById(id).style.display == 'none' || document.getElementById(id).style.display == '') ){
		document.getElementById(id).style.display = 'block';
		document.getElementById('img_'+id).src = "/resources/button_tiny_close.gif";
	}
}
function showSetPermissions (id) {
	if(document.getElementById && document.getElementById(id).style.display == 'block') {
		document.getElementById(id).style.display = 'none';
		//document.getElementById('img_'+id).src = "/resources/button_tiny_open.gif";
	}
	else if (document.getElementById && (document.getElementById(id).style.display == 'none' || document.getElementById(id).style.display == '') ){
		document.getElementById(id).style.display = 'block';
		//document.getElementById('img_'+id).src = "/resources/button_tiny_close.gif";
	}
}
function showAnswer(id) {
	if(document.getElementById && document.getElementById(id).style.display == 'block') {
		document.getElementById(id).style.display = 'none';
	}
	else if (document.getElementById && (document.getElementById(id).style.display == 'none' || document.getElementById(id).style.display == '') ){
		document.getElementById(id).style.display = 'block';
	}
}
function showMore(id) {
	if(document.getElementById && document.getElementById(id).style.display == 'block') {
		document.getElementById(id).style.display = 'none';
		document.getElementById('img_'+id).src = "/resources/button_tiny_open.gif";
	}
	else if (document.getElementById && (document.getElementById(id).style.display == 'none' || document.getElementById(id).style.display == '') ){
		document.getElementById(id).style.display = 'block';
		document.getElementById('img_'+id).src = "/resources/button_tiny_close.gif";
	}
}
function showPage(id1, id2) {
	$(id1).hide();
	$(id2).show();
}


startListNav = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("rightBoxNav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}

startListMainNav = function() {
	if (document.getElementById) {
		navRoot = document.getElementById("rightBoxMainNav");
		//alert("children:"+navRoot.childNodes.length);
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			//alert(node.nodeName);
			if (node.nodeName=="LI") {
				node.onclick=function() {
					//alert('click');
					//this.className+=" over";
				}
			}	
		}
	}
}

/*onload*/

window.onload = function () {
	/*style switcher*/
	var cookie = readCookie("style");
	var title = cookie ? cookie : getPreferredStyleSheet();
	/*if is print view and not library page, set style sheet to default */
	if (title == "print" && window.location.pathname != "/member/viewLibrary.htm") {
		setActiveStyleSheet("default");
		createCookie("style", "default", 365);
	}
	else if (title !="listview" && window.location.pathname == "/member/newItem.htm") { 
		setActiveStyleSheet("listview");
		createCookie("style", "listview", 365);
	}
	else {
	 setActiveStyleSheet(title);
	}
	
	/*FAT*/
	Fat.fade_all();
	
	/*CSS-Dropdown-Listen for IE 6*/
	startListNav();
}

function showNav(id) {
	$(id).show();
	document.onmousedown = function () {
		$(id).hide();
	}
}

function pageNavIconOn(obj) {
	obj.src='/resources/button_select_bg2_a.gif';
}
function pageNavIconOff(obj) {
	obj.src='/resources/button_select_bg2.gif';
}


window.onunload = function(e) {
	var title = getActiveStyleSheet();
	createCookie("style", title, 365);
}