function stopError() { return true;}
window.onerror = stopError;

var myRemote;
window.onunload=CloseRemote;

function CloseRemote()
{
	if (myRemote!=null) myRemote.close();
}

function ns_ShowWindowEx(i,newURL,x,y,w,h) {
	var NS6 = (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko"));
	if (!NS6)
	{
		IE = (document.all) ? true : false;
		NS4 = (document.layers) ? true : false;
	}
	else
	{
		IE = false;
		NS4 = false;
	}
	
	if(NS4)
	{
		if (myRemote==null) {
			  myRemote = window.open(newURL, '', 'height='+h+',width='+w+',screenX='+x+',left='+x+',screenY='+y+',top='+y+',channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0', 'myWindow');
			  myRemote.focus();
		}
		else{
			if(!myRemote.closed)	// Mora zaradi Netscape oti ako myRemote e zatvoren od strana na korisnikot puka
			{
				myRemote.close();
			}
			
			myRemote = window.open(newURL, '', 'height='+h+',width='+w+',screenX='+x+',left='+x+',screenY='+y+',top='+y+',channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0', 'myWindow');
			myRemote.focus();
		}	
	}
	else
	{
		if (myRemote==null) {
			  myRemote = window.open(newURL, '', 'height='+h+',width='+w+',screenX='+x+',left='+x+',screenY='+y+',top='+y+',channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0', 'myWindow');
			  myRemote.focus();
		}
		else{
			if(!myRemote.closed)	// Mora zaradi Netscape oti ako myRemote e zatvoren od strana na korisnikot puka
			{
				myRemote.close();
			}
			
			myRemote=null;
			myRemote = window.open(newURL, '', 'height='+h+',width='+w+',screenX='+x+',left='+x+',screenY='+y+',top='+y+',channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0', 'myWindow');
			myRemote.focus();
		}	
	}
}



function dummy(){
}

//wb2flymenu scripts

var prevPopup=null;
var timeOutID=0;
var subMenuOffset=0;
			
function mouseIn(src,childID)
{
	var chMenu = document.all(childID);
	var posLeft;
	var posTop;
	var posWidth;
	var x;
	var y;
	var masterParent=null;
				
	if(prevPopup!=null)
	{
		if(prevPopup!=chMenu)
		{
			prevPopup.style.visibility="hidden";
		}
	}
	
/*	masterParent = src
	while(true)
	{
		masterParent = masterParent.parentElement;
		if(masterParent==null)
		{
			break;
		}
		posLeft = posLeft + masterParent.offsetLeft;
	}*/
			
	//posLeft = src.parentElement.parentElement.parentElement.parentElement.parentElement.offsetLeft;
	
	//posLeft = src.parentElement.parentElement.parentElement.parentElement.offsetLeft;
	//posTop = src.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.offsetTop;
	prevPopup = chMenu;
	posLeft = src.offsetLeft-17;
	//posLeft = window.event.clientX;
	//document.title = src.tagName;
	posTop = src.offsetTop + src.offsetHeight + 5;
	 

	
	//posWidth = src.offsetWidth;
	posWidth = 0;
				
	y = posTop;
	x = subMenuOffset+posLeft+posWidth;
	chMenu.style.visibility="visible";
	chMenu.style.left = 2+x+"px";
	chMenu.style.top = 2+y+"px";
}
			
function mouseOut(src,childID)
{
	var strEval;
				
	if(!src.contains(window.event.toElement))
	{
		strEval = new String();
		strEval = "MainMenuTimer('" + childID + "')";
		timeOutID = window.setTimeout(strEval,250);
	}
}
			
function MainMenuTimer(childID)
{
	var chMenu = document.all(childID);
	chMenu.style.visibility="hidden";
	if(timeOutID!=0)
	{
		window.clearTimeout(timeOutID);
		timeOutID = 0;
	}
}
			
function subMenuMouseIn(src,elementID)
{
	if(timeOutID!=0)
	{
		window.clearTimeout(timeOutID);
		timeOutID = 0;
	}
}
			
function subMenuMouseOut(src,elementID)
{
	if(!src.contains(window.event.toElement))
	{
		var chMenu = document.all(elementID);
		chMenu.style.visibility="hidden";
	}
}
// end of wb2flymenu




/*
Copyright 2005, 4word systems
All rights reserved.

This software may not be reproduced or distributed in any form without the express 
written consent of 4word systems or it's designee.

Revision 1.1:  20050729 Added underscore to list of valid characters
*/


function isValidEmail(email, required) {
    if (required==undefined) {   // if not specified, assume it's required
        required=true;
    }
    if (email==null) {
        if (required) {
            return false;
        }
        return true;
    }
    if (email.length==0) {  
        if (required) {
            return false;
        }
        return true;
    }
    if (! allValidChars(email)) {  // check to make sure all characters are valid
        return false;
    }
    if (email.indexOf("@") < 1) { //  must contain @, and it must not be the first character
        return false;
    } else if (email.lastIndexOf(".") <= email.indexOf("@")) {  // last dot must be after the @
        return false;
    } else if (email.indexOf("@") == email.length) {  // @ must not be the last character
        return false;
    } else if (email.indexOf("..") >=0) { // two periods in a row is not valid
	return false;
    } else if (email.indexOf(".") == email.length) {  // . must not be the last character
	return false;
    }
    return true;
}

function allValidChars(email) {
  var parsed = true;
  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";
  for (var i=0; i < email.length; i++) {
    var letter = email.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) != -1)
      continue;
    parsed = false;
    break;
  }
  return parsed;
}
