function changeclassonmouseover(id,selected) {clearfield(selected);if(id!=selected){/*document.getElementById("c"+id).className = 'liblue';*/}hideshowsubmenu(id);}function clearfield(selected){/*var j=0;while(j<submenuitem.length){if(selected!=submenuitem[j])document.getElementById("c"+submenuitem[j]).className='liwhite';j++;}*/}function submenuin(k,s){if(k!=s){document.getElementById("sub_"+k).style.display='';document.getElementById("c"+k).className = 'liblue';document.getElementById("sub_"+s).style.display='none';}}function submenuout(k,s){if(k!=s){document.getElementById("sub_"+k).style.display='none';/*document.getElementById("c"+k).className='liwhite';*/} document.getElementById("sub_"+s).style.display='';}function hideshowsubmenu(id){var i=0;while(i<submenuitem.length){if(id!=submenuitem[i]){document.getElementById("sub_"+submenuitem[i]).style.display='none';}else{document.getElementById("sub_"+submenuitem[i]).style.display='';}i++;}}
function setTrash(id){var f=document.getElementById("elementsid").value;var t = f.split(";");var x = '';var y = true;for(i = 0; i < t.length; i++){if(t[i]!=id){x = x + t[i]+";";}else{y = false;}}if(y){document.getElementById("elementsid").value = x + id + ";";}else{document.getElementById("elementsid").value = x;}}
function setdefault(){
	var i=0;while(i<submenuitem.length){if(subselected!=submenuitem[i]){document.getElementById("sub_"+submenuitem[i]).style.display='none';}else{document.getElementById("sub_"+submenuitem[i]).style.display='';}i++;}
}

function setTrash2(id){document.getElementById("elementsid").value = id+";";}
function checkBoxAll(checkbox,check){
	var txt='';
	for(var i=0;i<checkbox.length;i++){
		document.getElementById("id_"+checkbox[i]).checked=check;
		if(check){
			txt = txt + checkbox[i]+";";
		}
	}
	document.getElementById("elementsid").value = txt;
}

function showfield(id){
	document.getElementById(id).style.display='';
}

function checkLogin(linkurl){
	var login=document.getElementById('checkloginname').value;
	if(login.length!=0){
		advAJAX.get({
            url : linkurl+"js/advajax.php?func=login&user="+login,
            onSuccess : function(obj) {
                parseResult(obj.responseText);
            }
        });
	}
}

function parseResult(xml){
	var login=document.getElementById('checkloginname').value;
	document.getElementById("loginoff").style.display='none';
	document.getElementById("loginok").style.display='none';
	if(xml==1){
		field="loginoff";
		document.getElementById("linkloginajax").innerText = 'login'; 
		document.getElementById("linkloginajax").textContent = 'login'; 
	}else if(xml==0){
		document.getElementById("linkloginajax").innerText = login; 
		document.getElementById("linkloginajax").textContent = login; 
		field="loginok";
	}
	if(field.length!=0){
		document.getElementById(field).style.display='';
	}
}

function f2(action,wsk){
	document.getElementById("actionid"+wsk).value=action;
	document.actionform3.submit();
}

function f(conf,action,login,wsk){
	if(wsk!=3 && confirm(conf)){
		document.getElementById("actionid"+wsk).value=action;
		document.getElementById("userloginid"+wsk).value=login;
		if(wsk==2){
			document.actionform2.submit();
		}else{
			document.actionform.submit();
		}
	}else{
		if(wsk==3){
			alert(conf);
		}
	}
}

function deleteProfileComments(id,msg){
		if(confirm(msg)){
			document.getElementById("pp_id").value=id;
		 	document.profilecomentsform.submit();
		}
}
function deleteForumPost(id,msg){
		if(confirm(msg)){
			document.getElementById("ff_id").value=id;
		 	document.forumaction.submit();
		}
}
function editForumPost(id,links){
	add='height=200,width=560,left=200,top=50,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no';window.open(links+'/'+id,'Preview',add);
}

function photo(id,action){
	document.getElementById("photoid").value=id;
	document.getElementById("actionid").value=action;
	document.actionform.submit();
}
function showDocs(links,width,height){
	width = typeof(width) != 'undefined' ? width : 850;
  	height = typeof(height) != 'undefined' ? height : 800;
	add='height='+height+',width='+width+',left=200,top=50,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no';window.open(links,'Preview',add);
}
function openChatWindow(urllink,name){
	var i = Math.floor(Math.random() * 100000);
	var oldwin=window.open(urllink,i,'height=430,width=440,left=100,top=20,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no');}

function mainPageNew(show){
		document.getElementById(currentpage).style.display='none';
		document.getElementById(currentpage+"m").style.background="#ffffff";
		document.getElementById(currentpage+"w").style.background="#ffffff";
		document.getElementById(currentpage+"m").style.color="#7e8dc5";
		document.getElementById(show).style.display='';
		document.getElementById(show+"m").style.background="#7e8dc5";
		document.getElementById(show+"w").style.background="#7e8dc5";
		document.getElementById(show+"m").style.color="#ffffff";
		currentpage=show;
}

