

function InvalidMail(address) 
{
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(address) == false)  return true;
   return false;
}


function Right(str, n)
{
     if (n <= 0)
        return "";
     else if (n > String(str).length)
        return str;
     else {
        var iLen = String(str).length;
        return String(str).substring(iLen, iLen - n);
     }
}
function Left(str, n)
{
     if (n <= 0)
         return "";
     else if (n > String(str).length)
         return str;
     else
         return String(str).substring(0,n);
}


var dtCh= ".";
var minYear=1000;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    for (i = 0; i<s.length; i++)
    {   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary(year)
{
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n)
{
	for (var i = 1; i <= n; i++) 
	{
		this[i] = 31;
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
		if (i==2) {this[i] = 29;}
   } 
   return this;
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12);
	var pos1=dtStr.indexOf(dtCh);
	var pos2=dtStr.indexOf(dtCh,pos1+1);
	var strDay=dtStr.substring(0,pos1);
	var strMonth=dtStr.substring(pos1+1,pos2);
	var strMsg='';
	
	var strYear=dtStr.substring(pos2+1);
	strYr=strYear;
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1);
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1);
	for (var i = 1; i <= 3; i++) 
	{
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1);
	}
	month=parseInt(strMonth);
	day=parseInt(strDay);
	year=parseInt(strYr);
	if (pos1==-1 || pos2==-1) return 'Date mist be DD.MM.YYYY formated.';
	if (strMonth.length<1 || month<1 || month>12) return 'Date: incorrect month.';
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]) return 'Date: incorrect day.';
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear)	return 'Date: year must be 4 digits'+minYear+'-'+maxYear;
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false) return 'Incorrect date';
	
	return '';
}

function ValidateDatum(dt) // vrcas '' ako je u redu
{
	if(dt=='') return '';
	if(dt.length!=10) return 'Date must be DD.MM.YYYY formated.';
	return (isDate(dt));
}


function Fmt_Num(n,isdcm)
{
	if (isdcm)
		n=RJRound(n,2);
	else
		n=RJRound(n,0);
	
	var a,b,c,d,e,f,i,re;
	a='';
	b=parseInt(n)+'falls';
	re = /falls/i;
	c=b.search(re);
	for (i=c-1;i>=0;i-=3)
	{
		d=b.charAt(i-2)+b.charAt(i-1)+b.charAt(i);
		if (a=='') 
			a=d;
		else
			a=d+','+a;
	}
	if (isdcm==true)
	{
		a=a+'.';
		re = /\./;
		n=n.toString();
		c=n.search(re);
		if (c>-1)
		{
			if (n.charAt(c+1) !='') a=a+n.charAt(c+1);
			if (n.charAt(c+1) =='') a=a+'0';
			if (n.charAt(c+2) !='') a=a+n.charAt(c+2);
			if (n.charAt(c+2) =='') a=a+'0';
		}
		else
		{
			a=a+'00';
		}
	}
	if (a.substring(0,2)=='-,') a=a.substring(0,1)+a.substring(2);
	if (a.substring(0,1)==',') a=a.substring(1);
	return a;
}

function RJRound(n,dcm)
{
 return Math.round(n*Math.pow(10,dcm))/Math.pow(10,dcm);
}




/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee

