var menutimer;
var menu_y=new Array(220,240,260,280,300,330,350,370,390,410,430,450,475,510,550,580,610,630,650,670,700);
function show_menu(x){
	clearTimeout(menutimer);
	for(i=0;i<25;i++){
		if(document.getElementById('menu_'+i)){
			if(i == x){
				document.getElementById('menu_'+x).style.top=menu_y[x]+'px';
				document.getElementById('menu_'+i).style.visibility='visible';
			}else{
				document.getElementById('menu_'+i).style.visibility='hidden';
			}
		}
	}
}


function hide_menu(x){
	menutimer=setTimeout("wipe('menu_"+x+"')",400);
}
function wipe(x){
	clearTimeout(menutimer);
	if(document.getElementById(x)){
		document.getElementById(x).style.visibility='hidden';
	}
}


function set_q(q){
	if(!q){
		document.getElementById('q').value='(search)';
	}else{
		
		document.getElementById('q').value=q;
	}
}
function clear_q(){
	if(document.getElementById('q').value=='(search)'){
		document.getElementById('q').value='';
	}
}


function loginlink(){
	document.write("<A HREF=\"/login.html\" STYLE=\"font-family:arial,geneva,sans-serif;font-size:9px;color:#ffffff;\">log in</A>");
}
function editlogout(x,y){
	document.write("<A HREF=\"/logout.html\" STYLE=\"font-family:arial,geneva,sans-serif;font-size:9px;color:#ffffff;\">log out</A>&nbsp;|&nbsp;");
	document.write("<A HREF=\"/admin.html\" STYLE=\"font-family:arial,geneva,sans-serif;font-size:9px;color:#ffffff;\">site administration</A>");
	if(y>0){
		document.write("&nbsp;|&nbsp;<span STYLE=\"font-family:arial,geneva,sans-serif;font-size:9px;color:#cccccc;text-decoration:underline;\">edit page</span>");
	}else{
		document.write("&nbsp;|&nbsp;<A HREF=\"/wysiwyg/index.html?url="+x+"\" STYLE=\"font-family:arial,geneva,sans-serif;font-size:9px;color:#ffffff;\">edit page</A>");
	}
}




/*

function blackout(msg){
	if(isIE){
	
		document.getElementById('blackout').style.position='absolute';
		document.getElementById('blackout_user_input_table').style.position='absolute';
		document.getElementById('blackout_input_bkg').style.position='absolute';
		
		document.getElementById('blackout').style.top=document.body.scrollTop+'px';
		document.getElementById('blackout_user_input_table').style.top=(document.body.scrollTop + 200)+'px';
		document.getElementById('blackout_input_bkg').style.top=(document.body.scrollTop + 200)+'px';
		
		document.getElementById('blackout').style.top=document.body.scrollLeft+'px';
		document.getElementById('blackout_user_input_table').style.top=(document.body.scrollLeft + 300)+'px';
		document.getElementById('blackout_input_bkg').style.top=(document.body.scrollLeft + 300)+'px';
		
	}
	document.getElementById('blackout').style.display='block';
	document.getElementById('blackout_user_input_table').style.display='block';
	document.getElementById('user_input_bkg').style.display='block';
	
	document.getElementById('blackout_user_input').value='';
	document.getElementById('blackout_message').innerHTML='<P>'+msg+'</P>';
	//alert(msg);
}
function blackout_cancel(){
	document.getElementById('blackout').style.display='none';
	document.getElementById('blackout_user_input_table').style.display='none';
	document.getElementById('user_input_bkg').style.display='none';
}



*/





if(window.ActiveXObject){
	var isIE=1;
}else{
	var isIE=0;
}

/*
	AJAX CODE
	
	This is a basic AJAX function set. Give it a URL to query, and a page item id and the 
	function will attempt to set the "innerHTML" value of "id" to the reulting text/html of "url".
	
	If the id parameter is omitted, the script will still execute the code on the server-side 
	page (the url parameter), but no feedback will be displayed on screen.
*/
var req;
function ajax(url,id){
	var ajax_target_id=id;
	if(window.XMLHttpRequest){
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send(null);
	}else if(isIE){
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req){
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send();
		}
	}
	function processReqChange(){
		if(req.readyState == 4){
			if(req.status == 200){
				if(document.getElementById(ajax_target_id)){
					document.getElementById(ajax_target_id).innerHTML = req.responseText;
					return true;
				}else{
					return true;
				}
			}
		}
		return false;
	}
}