var currActive = null;

e = window.event; 

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

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

function tmpon(o){o.className = 'tmp_s';}
function tmpoff(o){o.className = 'tmp';}

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

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

function bi_mon(o){o.className = 'bi_topmenu_s';}
function bi_moff(o){o.className = 'bi_topmenu';}

function bi_lon(o){o.className = 'bi_txtblue_s';}
function bi_loff(o){o.className = 'bi_txtblue';}

function bi_fon(o){o.className = 'bi_fl_s';}
function bi_foff(o){o.className = 'bi_fl';}

//---------------------------------------------------------------------
//------------------------- Misc. function ----------------------------
//---------------------------------------------------------------------

function showStatus(sMsg) {
    window.status = sMsg ;
    return true ;
}

//---------------------------------------------------------------------
function getRadioValue(radioName){

	//var collection; collection = document.all[radioName];
	//if(collection){for(i=0;i<collection.length;i++){if(collection[i].checked){return(collection[i].value);}}}	
	
	var collection; 
	if (nn && document.getElementById && document.getElementById(radioName) != null){var collection = document.getElementById(radioName);}
	else if (document.layers && document.layers){var collection = document.layers[radioName];}
	else if (!nn && document.all){collection = document.all[radioName];}
	if(collection){for(i=0;i<collection.length;i++){if(collection[i].checked){return(collection[i].value);}}}
}

//---------------------------------------------------------------------
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>";
	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 sizevedit(x,y){
	
	document.getElementById("veditin").innerHTML = divloading;
	
	var posx = parseInt((winW - x) / 2);
	var posy = parseInt((winH - y) / 2);
	
	if(!nn){posy = posy + document.documentElement.scrollTop}
	else{posy = posy + window.pageYOffset;}
	
	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 getMouseXY(e) {

	if (e == null){e = window.event;} 

	var rd = { x:0 ,y:0 };	
	
	if (!nn) { // grab the x-y pos.s if browser is IE
	rd.x = event.clientX + document.body.scrollLeft;
	rd.y = event.clientY + document.body.scrollTop;
	} else {  // grab the x-y pos.s if browser is NS
	rd.x = e.pageX;
	rd.y = e.pageY;
	}   
 	
	
	return rd;
}

//---------------------------------------------------------------------
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 = '1';}
	if (toolbar == ''){toolbar= '1';}
  
	var popUpA = window.open(cUrl, 'popupA', 'width='+width+',height='+height+',left='+x+',top='+y+',toolbar='+toolbar+',location=0,status=0,scrollbars='+scrollbars+',noresize,menubar=0');
	popUpA.focus();
}

//---------------------------------------------------------------------
//------------------------- Error function ----------------------------
//---------------------------------------------------------------------
var err = false;

function isaNr(string) {
    for (var i=0;i < string.length;i++){
        if ((string.substring(i,i+1) < '0') || (string.substring(i,i+1) > '9')){return false;}
    }
    	return true;
}

function valname(v){
	if (v.length < 1 || v.search(/^([a-zA-Z0-9*]|[a-zA-Z0-9*][a-zA-Z0-9*]{0,64}[a-zA-Z0-9*])$/) == -1){
	      err = true;document.getElementById('err1').innerHTML=tchars;
	      return false;
    }
	  else{err = false;document.getElementById('err1').innerHTML='';return true;}
}
function valemail(v){
	if (v.search(/^[a-zA-Z0-9\.\-\_]+\@([a-zA-Z0-9\-]+\.)*[a-zA-Z]+$/) == -1) {
	      err = true;document.getElementById('err2').innerHTML=tvalemail; 
	      return false;
    }
	  else{err = false;document.getElementById('err2').innerHTML='';return true;}
}
function valsubdom(v){
	if (v.search(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,24}[a-zA-Z0-9])$/) == -1){
		err = true; document.getElementById('err2').innerHTML=tvalsubdomain; 
		return false;
	}
	else{err = false;document.getElementById('err2').innerHTML='';return true;}	
}
function valcrblog(){	
	
	if(document.f1a.newblogname.value.length<4){alert(tnewblogname);return false;}	
	else if(document.f1a.realname.value.length<4){alert(trealname);return false;}
	else if(document.f1a.password.value.length<4){alert(tpassword);return false;}
	else{return true;}

}	

function valerr(){if(err){alert(tformerror);return false;}else{return true;}}



