var blank = "images/blank.gif";

topedge = 200;  // location of news box from top of page
leftedge = screen.width/2-320;  // location of news box from left edge
boxheight = 400;  // height of news box
boxwidth = 800;  // width of news box
scrollheight = 550; // total height of all data to be scrolled

function scrollnews(cliptop) {
if (document.layers) {
newsDiv = document.news;
newsDiv.clip.top = cliptop;
newsDiv.clip.bottom = cliptop + boxheight;
newsDiv.clip.left = 0;
newsDiv.clip.right = boxwidth + leftedge;
newsDiv.left = leftedge;
newsDiv.top = topedge - cliptop;
}
else {
newsDiv = news.style;
newsDiv.clip = "rect(" + cliptop + "px " + (boxwidth + leftedge) + "px " + (cliptop + boxheight) + "px 0px)";
newsDiv.pixelLeft = leftedge;
newsDiv.pixelTop = topedge - cliptop;
}
cliptop = (cliptop + 1) % (scrollheight + boxheight);
newsDiv.visibility='visible';
setTimeout("scrollnews(" + cliptop + ")", 50);
}
//-------------------------------------------------
function checkfields(){

	var frm=document.kontaktForm;
	var mail=frm.email.value;

	if(frm.name.value=='' || frm.company.value=='' || frm.email.value=='' || frm.subject.value=='' || frm.message.value==''){
		alert("Sva polja je potrebno popuniti.");
		return false;
	}
	if(!is_email_valid(mail)){
		alert("Email adresa nije ispravna.");
		return false;
	}
	else return true;
}
//-------------------------------------------------
function is_email_valid(emailx)
{
	var myEMailIsValid=true;
	var myAtSymbolAt=emailx.indexOf('@');
	var myLastDotAt=emailx.lastIndexOf('.');
	var mySpaceAt=emailx.indexOf(' ');
	var myLength=emailx.length;

	if(myAtSymbolAt < 1) myEMailIsValid=false;
	if(myLastDotAt < myAtSymbolAt) myEMailIsValid=false;
	if(myLength - myLastDotAt <= 2) myEMailIsValid=false;
	if(mySpaceAt != -1) myEMailIsValid=false;
	return myEMailIsValid;
}
//-------------------------------------------------