/* opens new window */ function doPopup(URL,width,height){URL = 'http://www.vresk.sk/'+ URL;winprop = "resizable=no, scrollbars=no, status=0, menubar=0, width=" + width + ", height=" + height; newWin = window.open(URL,"image",winprop);newWin.focus();return false;}

/* function for email check */function CheckEmail (EmailObject, theAlert) { if(EmailObject.value.length >= 0 && EmailObject.value.length < 8){alert(theAlert);EmailObject.focus();return false;} if ( EmailObject.value.length > 0){ for(var i=0, j=0; i<EmailObject.value.length; i++)if(EmailObject.value.charAt(i) == '@')j++; if(j!=1){alert(theAlert);EmailObject.focus();return false;}} return true;}
/*  check form items on submit */ function CheckFormItems(theForm){ var ok = true; pwd1Defined = false; pwd2Defined = false; pwd1=""; pwd2=""; for (var i = 0; i < theForm.elements.length; i++) { var e = theForm.elements[i]; if(e.name == "Password"){pwd1 = e.value; pwd1Defined = true;} if(e.name == "Password2"){pwd2 = e.value; pwd2Defined = true;} if(pwd1 != pwd2 && pwd1Defined && pwd2Defined){alert("Check the passwords!"); e.focus(); return false;} if (e.name && !(e.name.indexOf('def_')>= 0)){ if ( typeof(eval('theForm.elements["dfs_' + e.name + '"]')) != "undefined" ){ defselval = eval('theForm.elements["dfs_' + e.name + '"].value'); selvalues = defselval.split('_');selrequired = selvalues[0];selalert = selvalues[1]; if(selrequired=='req')sreq=true; else sreq = false; if (sreq && e.value == 'null'){alert(selalert);	return false;} } if ( !(typeof(eval('theForm.elements["def_' + e.name + '"]')) == "undefined") ){ defval = eval('theForm.elements["def_' + e.name + '"].value'); values = defval.split('_'); datatype = values[0]; required = values[1]; alertmessage = values[2]; alertmessage2 = values[3]; if(required == 'req') req = true; else req = false; if(datatype == 'int' || datatype == 'float')needN = true; else needN = false; if (req && e.value == ''){alert(alertmessage);if (e.type!='hidden')e.focus(); return(false);} if (!checknumber(e.value) && needN && e.value!=''){alert(alertmessage2); if(e.type!='hidden')e.focus();	return(false);} } } } return true; }

function checknumber(object_value){if (object_value.length == 0) return false; var start_format = " .+-0123456789"; var number_format = " .0123456789"; var check_char; var decimal = false; var trailing_blank = false; var digits = false; check_char = start_format.indexOf(object_value.charAt(0)); if (check_char == 1)decimal = true; else if(check_char < 1)return false; for (var i = 1; i < object_value.length; i++){ check_char = number_format.indexOf(object_value.charAt(i)); if (check_char < 0)return false; else if (check_char == 1){if(decimal)return false; else decimal = true;} else if (check_char == 0){if (decimal || digits)trailing_blank = true;} else if (trailing_blank) return false; else digits = true;} return true;}
/* opens new window for print */ function OpenWindow4Print() { var URL = "/print.php?"+location.href.substr(location.host.length + location.protocol.length + 3 + location.pathname.length); var newWin; newWin = window.open(URL, "Print", "resizable=no,scrollbars=yes,status=0,menubar=1,width=650,height=500"); newWin.focus(); return(false);}
function SendEmail(){var URL = "/email.php?Page="+location.href; var newWin; newWin = window.open(URL, "Email", "resizable=no,scrollbars=no,status=0,menubar=0,width=450,height=250"); newWin.focus(); return(false);}


// START of floating Div functions
var objDiv = new Object();
var X, Y;
var isMozilla;
function init(DivID) {objDiv = document.getElementById(DivID); objDiv.style.position = "absolute"; isMozilla = (document.all) ? 0 : 1; document.onmousedown = MouseDown; document.onmousemove = MouseMove; document.onmouseup = MouseUp;}
function MouseDown(e) {if (!e) var e = window.event; if (isMozilla) {X=e.layerX; Y=e.layerY; return false;} else { X=event.offsetX; Y=event.offsetY;}}
function MouseMove(e) {if (objDiv) {if (isMozilla) { objDiv.style.top = (e.pageY-Y) + 'px'; objDiv.style.left = (e.pageX-X) + 'px'; return false;} else{objDiv.style.left=event.clientX-X; objDiv.style.top=event.clientY-Y;return false;}}}
function MouseUp(){objDiv = null; document.onmousedown = null; document.onmousemove = null; document.onmouseup = null; return false;}
//end of floating div functions

var oObjIDToRelocate = "";
function SetPosition(AObj, ObjToMove){ oObjIDToRelocate = ObjToMove; document.getElementById(oObjIDToRelocate).style.display = 'none'; objDiv = document.getElementById(AObj.id); isMozilla = (document.all) ? 0 : 1; if (!e) var e = window.event; document.onmousedown = MouseDown; document.onmouseup = SetCurentPosition; AObj.onclick = MouseUp; return false; }
function SetCurentPosition(e){ if (!e) var e = window.event; var oDiv = document.getElementById(oObjIDToRelocate); oDiv.style.width="430px"; if (isMozilla) {oDiv.style.top = (e.pageY - 180) + 'px'; oDiv.style.left = X + 'px'; } else{oDiv.style.left=X; oDiv.style.top=Y - 10;}document.getElementById(oObjIDToRelocate).style.display = 'block';return false; } 
function SetForumForm(ParentID, Subject, Depth){ var f= document.forms.ForumForm; f.style.position = "absolute"; document.getElementById('CloseButton').style.display = "block"; f.style.float = "none"; f.ParentID.value = ParentID; f.Subject.value = "RE: " + Subject; f.Depth.value = Depth; }
function CheckScreen(){MainPic = document.getElementById("Image"); if (MainPic){ nWidth = MainPic.width+20; nHeight  = MainPic.offsetHeight+100; window.resizeTo (nWidth,nHeight); } }