str_empty = "\\s*";

str_host = "[-0-9a-zA-Z]+(\\.[-0-9a-zA-Z]+)+";

str_path = "\\/?[-/.0-9a-zA-Z&?%=_#]*";

str_email = "[-_.0-9a-zA-Z]+([+][-_.0-9a-zA-Z]+)*@"+str_host;

str_url = "((http:\\/\\/)|(ftp:\\/\\/)|(www[.])|(ftp[.]))"+str_host+"(\\/"+str_path+")?";

str_tel = "(([(][+]?[0-9]{2,3}[)])|([+]?[0-9]{2,3}))?[-. 0-9]{2,30}";           

str_int = "[+-]?[0-9]+";

str_pc = "[0-9]{4,5}";

str_float = "[-+]?[0-9]*(\\.[0-9]*)?";

str_pass = ".{4,}";

str_year = "((19)|(20))[0-9]{2}";

pcre_empty = new RegExp("^"+str_empty+"$");

pcre_host = new RegExp("^"+str_host+"$");

pcre_path = new RegExp("^"+str_path+"$");

pcre_email = new RegExp("^"+str_email+"$");

pcre_url = new RegExp("^"+str_url+"$");

pcre_tel = new RegExp("^"+str_tel+"$");

pcre_int = new RegExp("^"+str_int+"$");

pcre_pc = new RegExp("^"+str_pc+"$");

pcre_float = new RegExp("^"+str_float+"$");

pcre_pass = new RegExp("^"+str_pass+"$");

pcre_year = new RegExp("^"+str_year+"$");

function array2str(arr) {
    msg="";
    for(i=0;i<arr.length;i++) {
	msg+=(i+1)+". "+arr[i]+"\n";
    }
    return msg;
}

// JavaScript Document

//////////////////////////// CURSOR BEHAVIOUR //////////////////////////////////////////

var cursor_1="<table cellpadding='1' class='tipTable' cellspacing='0' cellpadding='1'><tr><td nowrap><div class='tipHead'><img src='images/bulletSub.gif' width='15' height='13' align='absmiddle'>";
var cursor_2='</div></td></tr><tr><td class="tipBody" nowrap> ';
var cursor_3='</td></tr></table>';


function cursor_txt(title, author, activ) {
    var buffer=cursor_1+title+cursor_2+author+cursor_3;
    setTextOfLayer('cursorimage','', buffer);
}
	
var ie = document.all ? 1 : 0
var ns = false
var mz = !ie;

var initialize =-1;
var Ex, Ey;


if(ie)	{
    document.onmousemove=overhere
    Ex = "event.x"
    Ey = "event.y"
}

function xxx(e) {
	window.status = ("sds" + event.x);
	return true;
}

if(ns){
    Ex = "e.pageX"
    Ey = "e.pageY"
    window.captureEvents(Event.MOUSEMOVE)
    window.captureEvents(Event.UNLOAD)
    window.onmousemove=overhere
}

if(mz){
    window.onmousemove=overhere
    Ex = "e.clientX"
    Ey = "e.clientY"
}


function MoveToolTip(layerName, FromTop, FromLeft, e)
{
    var dv = tmt_findObj(layerName);
    var el;
    if (document.documentElement) el=document.documentElement;
    else el=document.body;
    if(!dv) return;
    if (ns) {dv.top = eval(FromTop); dv.left = eval(FromLeft); return }
    lay = (dv.style)? dv.style : dv;
    lay.top = (eval(FromTop) + el.scrollTop)+'px';
    lay.left = (eval(FromLeft) + el.scrollLeft)+'px';
}


function tmt_findObj(n){
    x=document.getElementById(n);
    return x;
}

function setTextOfLayer(objName,x,newText) {//v3.0A Modified by Uncle Massimo and packaged by Uncle Al  for NN6 Compatibility
  var obj = (document.getElementById) ? tmt_findObj(objName) : findObj(objName);
  if (obj!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

var pozX=10;
var pozY=10;
function relXY(x,y)
{
    pozX=x; 
    pozY=Y;
}

function Activate(title, author, activ){
    initialize=1; 
    cursor_txt(unescape(title),unescape(author), activ)
}

function deActivate(){
    initialize=0; 
    return
}

function overhere(e){
    var pX, pY;
    lay = (tmt_findObj("cursorimage").style)? tmt_findObj("cursorimage").style : tmt_findObj("cursorimage");
    if(initialize==1){
		pX=pozX+eval(Ex);
		pY=pozY+eval(Ey);
		MoveToolTip("cursorimage", pY, pX, e)
		lay.visibility = "visible";
				}
    else if (initialize==0){			
			lay.visibility = "hidden";
			}
    else if (initialize==-1){}
    else return;
}

// open picture browser
var picWin=null;
function openPic(id) {
	if(picWin && !picWin.closed) { 		
		picWin.innerHTML = "Loading .. "; 
		picWin.resizeTo(600, 550);
	}
	/*
	var author = (auth)? ("&auth=" + escape(auth)) : "";
	picWin = window.open(("_inc/pic.php?title=" + escape(title) + "&src=" + escape(src) + author + "&ref=" + escape(document.location)), "pWin", 'scrollbars=yes,resizable=no,width=600,height=550');
	picWin.focus();
	*/	
	picWin = window.open(("gallery_pic.php?id=" + escape(id) + "&ref=" + escape(document.location)), "pWin", 'scrollbars=yes,resizable=no,width=600,height=550');
}
function openMap() {
	if(picWin && !picWin.closed) { 		
		picWin.innerHTML = "Loading .. "; 
		picWin.resizeTo(640, 590);		
	}	
	picWin = window.open("inc/map.php", "pWin", 'scrollbars=yes,resizable=no,width=640,height=590');
	picWin.focus();
}

function openGalleryPic(category, id, lastPic) {
	if(picWin && !picWin.closed) { picWin.innerHTML = "Loading .. "; }
	picWin = window.open(("_inc/galleryPic.php?category=" + escape(category) + "&id=" + escape(id) + "&lastPic=" + lastPic ), "pWin", 'scrollbars=yes,resizable=no,width=600,height=550');
	var a = document.getElementById("cursorimage");
	if(a) a.style.visibility = "hidden";
	picWin.focus();
}

//////////////////////////// END CURSOR BEHAVIOUR //////////////////////////////////////////

