var DHTML = (document.getElementById || document.all || document.layers);
	
function activateGetObj(name){
	if (document.getElementById){
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	}else if (document.all){
		this.obj = document.all[name];
		this.style = document.all[name].style;
	}else if (document.layers){
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}
}

function activateSetVisibility(id,isVisible){
	if (!DHTML) return;
	var x = new activateGetObj(id);
	x.style.visibility = (isVisible) ? 'visible' : 'hidden';
}

function activateSetDisplay(id,displayString){
	if (!DHTML) return;
	var x = new activateGetObj(id);
	x.style.display = displayString;
}

function activateSetClass(id,classString){
	if (!DHTML) return;
	var x = new activateGetObj(id);
	x.obj.className = classString;
}


function activatecmsShowImagePopup(url,title,width,height){
	var narsykle = window.opera || ( document.layers && !navigator.mimeTypes['*'] ) || navigator.vendor == 'KDE' || ( document.childNodes && !document.all && !navigator.taintEnabled ) || ( window.ScriptEngine && ScriptEngine() == 'JScript' && navigator.platform == 'Win32' && window.ActiveXObject && !navigator.__ice_version );
    var left=window.screen.width/2-width/2;
    var top=window.screen.height/2-height/2;
    var langas = window.open( ( narsykle ? '' : 'about:blank' ), 'nuotraukos', "height="+(height+2)+",width="+width+",left="+left+",top="+top+',location=0,menubar=0,scrollbars=0,status=0,toolbar=0' );
    html='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
    html+='<html xmlns="http://www.w3.org/1999/xhtml" lang="lt" xml:lang="lt">';
    html+='<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />';
    html+='<title>'+title+'<\/title>';
    html+='<style type="text/css">body{margin:0;padding:0;border:0;}<\/style>';
    html+='<\/head>';
    html+='<body>';
    html+='<a href="#" onclick="window.close()"><img src="'+unescape(url)+'" border="0"/><\/a>';
    html+='<\/body>';
    html+='<\/html>';

    langas.document.open();
    langas.document.write(html);
    langas.document.close();
    langas.focus();
    return false;
}

function activateCheckEmail(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1)return false;	
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)return false;	
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)return false;	
	 if (str.indexOf(at,(lat+1))!=-1)return false;	
	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)return false;	
	 if (str.indexOf(dot,(lat+2))==-1)return false;	
	 if (str.indexOf(" ")!=-1)return false;
	 return true					
}

function activateAddLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
function activateAddWindowResizeEvent(func){
	if(typeof window.addEventListener != 'undefined'){
		window.addEventListener("resize",func,false);
	}else if(typeof document.addEventListener != 'undefined'){
		document.addEventListener("resize",func,false);
	}else if(typeof window.attachEvent != 'undefined'){
		window.attachEvent("onresize",func);
	}else{
		return false;
	}
	return true;
}
