var stat = 0;
var polje = 0;
function stat_over(what){
	stat = 1;
	polje = what;

}
function stat_out(){
	stat = 0;

}

function GetDiv(what) {
 var div = null;
 if (document.getElementById)
   div = document.getElementById(what);
 else if (document.all) 
   div = document.all[what];
 else if (document.layers)   
   div = document.layers[what];
 return div;
}

function showMenu(what) { 
	try{
 		var div = GetDiv(what);
   	    div.style.visibility = "visible";
	}
	catch(e){}
}
function hideMenu(what) { 
 	
	try{
		if(stat == 0 || polje != what){
			var div = GetDiv(what);
    		div.style.visibility = 'hidden';
		}
	}
	catch(e){}
}
function dubleshowMenu(what1,what2) { 
 try{
 		var div1 = GetDiv(what1);
 		var div2 = GetDiv(what2);
   		div1.style.visibility = "visible";
   		div2.style.visibility = "visible";
   }
	catch(e){}
}
function dublehideMenu(what1,what2) { 
 try{	
	var div1 = GetDiv(what1);
 	var div2 = GetDiv(what2);
    div1.style.visibility = "hidden";
    div2.style.visibility = "hidden";
	}
	catch(e){}
}

function Validator1(theForm)
{
   

  if (theForm.podjetje.value == "" )
  {
    alert("Polja označena z * so obvezna!.");
    theForm.podjetje.focus();
    return (false);
  }
  if (theForm.email.value == "" )
  {
    alert("Polja označena z * so obvezna!.");
    theForm.email.focus();
    return (false);
  }
  var good_email = theForm.email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
  if (!good_email)
  {
  	alert("Prosim vpišite veljeven e-mail naslov!");
    theForm.email.focus();
    return (false);
  }
}
function Validator2(theForm)
{
   

  if (theForm.podjetje.value == "" )
  {
    alert("Polja označena z * so obvezna!.");
    theForm.podjetje.focus();
    return (false);
  }
  if (theForm.email.value == "" )
  {
    alert("Polja označena z * so obvezna!.");
    theForm.email.focus();
    return (false);
  }
  if (theForm.filefield.value == "" )
  {
    alert("Niste pripeli motiva!.");
    theForm.filefield.focus();
    return (false);
  }
  var good_email = theForm.email.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
  if (!good_email)
  {
  	alert("Prosim vpišite veljeven e-mail naslov!");
    theForm.email.focus();
    return (false);
  }
}
 function dynawin(url, h, w, l, t) {
	var poph = h + 0;
	var popw = w + 0;
	disp = window.open("","pop","height=" + poph + ",width=" + popw + ",left=" + l + ",top=" + t + "");
	with(disp.document) {
		writeln('<HTML><HEAD>');
		writeln('<TITLE>LOG d.o.o, izdelava promocijskih artiklov</TITLE>');
		writeln('</HEAD>');
		writeln('<BODY BACKGROUND="#FFFFFF" onBlur="self.close()" style="margin-top:0px; margin-left:0px">');
		writeln('<img src="' + url + '" height="' + h + '" width="' + w + '">');
		//writeln('<P ALIGN="CENTER"><A HREF="javascript:self.close()"><font face="Verdana" size="2">Zapri okno</font></A></P>');
		writeln('</BODY></HTML>');
		close();
	}

	//disp.document.write(content);
	//disp.document.close();
  }
  
    /* pozicija menujev */
function getRealLeft(el) {
	xPos = el.offsetLeft;
	tempEl = el.offsetParent;
	while (tempEl != null) {
		xPos += tempEl.offsetLeft;
		tempEl = tempEl.offsetParent;
	}
	return xPos;
}

function getRealTop(el) {
	yPos = el.offsetTop;
	tempEl = el.offsetParent;
	while (tempEl != null) {
		yPos += tempEl.offsetTop;
		tempEl = tempEl.offsetParent;
	}
	return yPos;
}

function display_pos_left(id) {
	var el = document.all ? document.all(id) :
	document.getElementById ? document.getElementById(id) : null;
	if (el) {
		var trueX = getRealLeft(el);
		return trueX;
	}
}
function display_pos_top(id) {
	var el = document.all ? document.all(id) :
	document.getElementById ? document.getElementById(id) : null;
	if (el) {
		var trueY = getRealTop(el);
		return trueY;
	}
}