var searchinput = false;
var currActive = null;

var nn = (navigator.appName == "Netscape");
var win = (navigator.userAgent.indexOf("Win")!=-1)
var browserversion = navigator.appVersion.substring(0,3)


if (nn){
  	var winW = window.innerWidth;
 	var winH = window.innerHeight;
}
else{
	var winW = 1000;
	var winH = 560;  	
	//var winW = document.documentElement.clientWidth;
	//var winH = document.documentElement.clientHeight;
}

function lnkon(o){o.className = 'lnk_s';}
function lnkoff(o){o.className = 'lnk';}

function editon(){editx.src='images/msgbox_x_s.gif';}
function editoff(){editx.src='images/msgbox_x.gif';}

function reon(o){if(currActive != o){o.className = 're_s';}}
function reoff(o){if(currActive != o){o.className = 're';}}

function ron(o){o.className = 'roll_s';}
function roff(o){o.className = 'roll';}

//---------------------------------------------------------------------
function buildwindows(){ 
	
	if (navigator.appName.indexOf("Microsoft")!=-1) {
		
		winW = document.body.offsetWidth-16;
		winH = document.body.offsetHeight;
	}  
	        
	        
	v00height = (winH-10);
	v00width = (winW-10);
}	

//---------------------------------------------------------------------
function popUpAll(cUrl,width,height,x,y,scrollbars,toolbar){

	if (width == 0){width = (v00width-40);}
	if (height == 0){height = (v00height-40);}
	if (x == 0){x = parseInt((v00width - width)/2);}
	if (y == 0){y = parseInt((v00height - height)/2);}
	if (scrollbars == ''){scrollbars = 'yes';}
	if (toolbar == ''){toolbar= 'yes';}
 
	var popUpA = window.open(cUrl, 'popupA', 'width='+width+',height='+height+',left='+x+',top='+y+',toolbar='+toolbar+',location=no,status=no,scrollbars='+scrollbars+',noresize,menubar=no');
	popUpA.focus();
}

//---------------------------------------------------------------------
function alertme(txt,type,action1,action2,sizex,sizey){
	
	var s = null;
	
	var butt = "<table border=0 cellspacing=0 cellpadding=0><tr>";
	butt += "<td><img src='images/b_l.gif' border=0 width=3 height=20></td>";
	butt += "<td onClick=\"#action#\" class=button align=center>#txtbut#</td>";
	butt += "<td><img src='images/b_r.gif' border=0 width=3 height=20></td>";
	butt += "</tr></table>";
	
	var diva1 = "<table width='100%' border=0 cellspacing=4 cellpadding=4 style='padding:10px;' ><tr><td rowspan=2 valign=top><img src='images/ico_alert.gif' width=35 height=35></td><td valign=top colspan=2 align=center>";
	var diva2 = "</td></tr><td align=center colspan=2>#button#</td></tr>";
	var diva22 = "</td></tr><td>#button1#</td><td align=right>#button2#</td></tr>";		//alt
	var diva3 = "</td></tr></table>";

	if(type=='alert'){

		var thisbut = butt.replace("#txtbut#","OK");
		thisbut = thisbut.replace("#action#","naviswitch('editoff');");
		s = diva1+txt+diva2.replace("#button#",thisbut)+diva3;
		
	}
	else if(type=='question'){

		var thisbut1 = butt.replace("#txtbut#",tyes);thisbut1 = thisbut1.replace("#action#",action1);
		var thisbut2 = butt.replace("#txtbut#",tno);thisbut2 = thisbut2.replace("#action#",action2);
		s = diva22.replace("#button1#",thisbut1);
		s = s.replace("#button2#",thisbut2);
		s = diva1+txt+s+diva3;
	}


	sizevedit(sizex,sizey);document.getElementById("veditin").innerHTML = s;naviswitch('edit');	

}

//---------------------------------------------------------------------
function popUpAll(cUrl,width,height,x,y,scrollbars,toolbar){

	//if (x == 0){x = ((window.screen.width - width)/2);}
	//if (y == 0){y = ((window.screen.height - height)/2);}
	if (scrollbars == ''){scrollbars = 'yes';}
	if (toolbar == ''){toolbar= 'yes';}

	var popUpA = window.open(cUrl, 'popupA', 'width='+width+',height='+height+',left='+x+',top='+y+',toolbar='+toolbar+',location=no,status=yes,scrollbars='+scrollbars+',resizable=1,menubar=no');
	popUpA.focus();
}

//---------------------------------------------------------------------
var divloading = '<table width="100%" height="100%"><tr><td><div width="100%" align=center><img src="images/loading3.gif" width=16 height=16><br><font style="font-size:8px;">LOADING</font></div></td></tr></table>';


function sizevedit(x,y){
	
	document.getElementById("veditin").innerHTML = divloading;
	
	var posx = parseInt((winW - x) / 2);
	var posy = parseInt((winH - y) / 2);
	if(posy<0){posy=0;}if(posx<0){posx=0;}
	
	document.getElementById("vedit").style.width= x + 'px';
	document.getElementById("vedit").style.height= y + 'px';
	
	document.getElementById("vedit").style.left= posx + 'px';
	document.getElementById("vedit").style.top= posy + 'px';	
	
	document.getElementById("veditin").style.height= (y-25) + 'px';
}

//---------------------------------------------------------------------
function naviswitch(name){
	

	currNavi=name;



	if(name=='edit'){

		document.getElementById("vedit").style.visibility="visible";

	}	
	else if(name=='editoff'){

		if(document.getElementById('entrytop')){document.getElementById('entrytop').style.visibility='visible';}
		document.getElementById("vedit").style.visibility="hidden";
		document.getElementById("veditin").innerHTML = divloading;
		closeedit = true;
	}		

}
//---------------------------------------------------------------------
function edittophide(){
	
	if(document.getElementById('entrytop')){document.getElementById('entrytop').style.visibility='visible';}
}
//---------------------------------------------------------------------
