var werd;
function openopen(linkk,name,w_,h_){
	linkk='popwin.php?link='+linkk+'&dir='+name;
	var up_=100;
	var left_=100;
	param = 'top='+up_+',left='+left_+',width='+w_+',height='+h_;
	if (navigator.userAgent.toLowerCase().indexOf("opera")==-1 && werd!=null && !werd.closed)werd.close();
	werd=window.open(linkk,name, param+',status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no');
	werd.focus();
}
var un_window;
function open_win(links,name,h,w){
	if (navigator.userAgent.toLowerCase().indexOf("opera")==-1 && un_window!=null && !un_window.closed)un_window.close();
	tops(h,w);
	un_window=window.open(links,name,"height="+h+",width="+w+",status=no,toolbar=no,menubar=no,location=no,top="+top_+",left="+left_+",scrollbars=no,resizable=yes");
	un_window.focus();
}
var nam;
var nam_1=null;//=window.close,canClose = window.opener;
function dok0(url,h,w){
	if (navigator.userAgent.toLowerCase().indexOf("opera")==-1 && nam!=null && !nam.closed)nam.close();
	tops(h,w);
	nam=window.open(url,'',"height="+h+",width="+w+",status=no,toolbar=no,menubar=no,location=no,top="+top_+",left="+left_+",scrollbars=no,resizable=yes");
	nam.focus();
}
function dok1(url,h,w){
	if (navigator.userAgent.toLowerCase().indexOf("opera")==-1 && nam_1!=null && !nam_1.closed)nam_1.close();
	tops(h,w);
	nam_1=window.open(url,'',"height="+h+",width="+w+",status=yes,toolbar=no,menubar=yes,location=no,top="+top_+",left="+left_+",scrollbars=yes,resizable=yes");
	nam_1.focus();
}
function tops(h,w){
	if (navigator.appName == "Netscape") {
		top_=window.innerHeight/2-h/2;
		left_=window.innerWidth/2-w/2;
	}
	else {
		top_=document.body.clientHeight/2-h/2;
		left_=document.body.clientWidth/2-w/2;
	}
}
function get_cur_date(b){
	a=new Date();
	year=a.getYear();
	if(year<2000)year+=1900;
	if((a.getMonth()+1+b)>12)return "01/01/"+(year+1);
	return "01/"+(a.getMonth()+1+b)+"/"+year;
}
function get_cur_date_year(b){
	a=new Date();
	year=a.getYear();
	if(year<2000)year+=1900;
	return (year-b)+"-01-01";
}

function default_menu(){
	if(!document.getElementById)return;
	clear_color();
	//invert_activ(false);
	if(document.getElementById("a"+cl_menu)){
		document.getElementById("a"+cl_menu).style.color='#000000';
		document.getElementById("a"+cl_menu).style.backgroundColor='#FFF200';
	}
	if(typeof(submenu[cl_menu])=='undefined')submenu[cl_menu]='';
	dhtml_objects["div_submenu"].set_html(submenu[cl_menu]);
}
function set_timeout(){
	timeout=setTimeout("default_menu()",300);
}
function clear_timeout(){
	clearTimeout(timeout);
	//
	clearTimeout(timeout1);
}
function clear_timeout1(){
	clearTimeout(timeout1);
}
function setText_li(form_){
	form_.value=form_.value+'\n<ul>\n<li>\n<li>\n</ul>';
}
function setText_table(form_){
	form_.value=form_.value+'\n<table border=1 cellspacing=0 cellpadding=4>\n<tr><td></td><td></td></tr>\n</table>';
}
function wrapTag(txtarea, lft, rgt) {
	lft = unescape(lft);
	rgt = unescape(rgt);
	if (document.all) {
		WrapIE(lft, rgt);
	}
	else if (document.getElementById) {
		wrapMoz(txtarea, lft, rgt);
	}
}
// IE only - wraps selected text with lft and rgt
function WrapIE(lft, rgt) {
	strSelection = document.selection.createRange().text;
	if (strSelection!="") {
		document.selection.createRange().text = lft + strSelection + rgt;
	}
}
// Moz only - wraps selected text with lft and rgt
function wrapMoz(txtarea, lft, rgt) {
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	if (selEnd==1 || selEnd==2) selEnd=selLength;
	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);
	txtarea.value = s1 + lft + s2 + rgt + s3;
}
