﻿/***********************************************
* ProHTML Ticker script- &copy; Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
var tickspeed=4000 //ticker speed in miliseconds (2000=2 seconds)
var enablesubject=1 //enable scroller subject? Set to 0 to hide

if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.dropcontent{display:none;}\n')
document.write('</style>\n')
}

var selectedDiv=0
var totalDivs=0

function contractall(){
var inc=0
while (document.getElementById("dropmsg"+inc)){
document.getElementById("dropmsg"+inc).style.display="none"
inc++
}
}


function expandone(){
var selectedDivObj=document.getElementById("dropmsg"+selectedDiv)
contractall()
document.getElementById("dropcontentsubject").innerHTML=selectedDivObj.getAttribute("title")
selectedDivObj.style.display="block"
selectedDiv=(selectedDiv<totalDivs-1)? selectedDiv+1 : 0
setTimeout("expandone()",tickspeed)
}

function startscroller(){
while (document.getElementById("dropmsg"+totalDivs)!=null)
totalDivs++
expandone()
if (!enablesubject)
document.getElementById("dropcontentsubject").style.display="none"
}

if (window.addEventListener)
window.addEventListener("load", startscroller, false)
else if (window.attachEvent)
window.attachEvent("onload", startscroller)



function again(){
document.icaptcha.SetVariable("again","OK");
}
function checking(){
document.icaptcha.SetVariable("code",document.validate.code.value);
}
function insert(){
document.validate.submit();
}



/* Random Div Display
   Version 1.0
   March 9, 2009
   Will Bontrager
   http://www.willmaster.com/
   Copyright 2009 Bontrager Connection, LLC

For information about implementing this software, see the article at
http://www.willmaster.com/library/javascript/random-div-display.php
*/

// One place to customize:
//
// Type the number of div containers to randomly display.



// No other customizations required.
////////////////////////////////////
var CookieName = 'DivRamdomValueCookie';
function DisplayRandomDiv() {
var r = Math.ceil(Math.random() * NumberOfDivsToRandomDisplay);
if(NumberOfDivsToRandomDisplay > 1) {
   var ck = 0;
   var cookiebegin = document.cookie.indexOf(CookieName + "=");
   if(cookiebegin > -1) {
      cookiebegin += 1 + CookieName.length;
      cookieend = document.cookie.indexOf(";",cookiebegin);
      if(cookieend < cookiebegin) { cookieend = document.cookie.length; }
      ck = parseInt(document.cookie.substring(cookiebegin,cookieend));
      }
   while(r == ck) { r = Math.ceil(Math.random() * NumberOfDivsToRandomDisplay); }
   document.cookie = CookieName + "=" + r;
   }
for( var i=1; i<=NumberOfDivsToRandomDisplay; i++) {
   document.getElementById("randomdiv"+i).style.display="none";
   }
document.getElementById("randomdiv"+r).style.display="block";
}




/*
Clear default form value script- By Ada Shimar (ada@chalktv.com)
Featured on JavaScript Kit (http://javascriptkit.com)
Visit javascriptkit.com for 400+ free scripts!
*/

function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
} 





function checkbae(){
if (document.layers||document.getElementById||document.all)
return checkemail()
else
return true
}



/***********************************************
* Email Validation script- &copy; Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i

function checkmail(e){
var returnval=emailfilter.test(e.value)
if (returnval==false){
alert("Napačen e-mail naslov.")
e.select()
}
return returnval
}

function formCheck(formobj){
        // Enter name of mandatory fields
        var fieldRequired = Array("vase_ime", "vas_email", "prijateljevo_ime", "prijateljev_email");
        // Enter field description to appear in the dialog box
        var fieldDescription = Array("vase_ime", "vas_email", "prijateljevo_ime", "prijateljev_email");
        // dialog message
        var alertMsg = "Vpišite obvezne podatke:\n";
        
        var l_Msg = alertMsg.length;
        
        for (var i = 0; i < fieldRequired.length; i++){
                var obj = formobj.elements[fieldRequired[i]];
                if (obj){
                        switch(obj.type){
                        case "select-one":
                                if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
                                        alertMsg += " - " + fieldDescription[i] + "\n";
                                }
                                break;
                        case "select-multiple":
                                if (obj.selectedIndex == -1){
                                        alertMsg += " - " + fieldDescription[i] + "\n";
                                }
                                break;
                        case "text":
                        case "textarea":
                                if (obj.value == "" || obj.value == null){
                                        alertMsg += " - " + fieldDescription[i] + "\n";
                                }
                                break;
                        default:
                        }
                        if (obj.type == undefined){
                                var blnchecked = false;
                                for (var j = 0; j < obj.length; j++){
                                        if (obj[j].checked){
                                                blnchecked = true;
                                        }
                                }
                                if (!blnchecked){
                                        alertMsg += " - " + fieldDescription[i] + "\n";
                                }
                        }
                }
        }

        if (alertMsg.length == l_Msg){
                return true;
        }else{
                alert(alertMsg);
                return false;
        }
}

function roll_over(img_name, img_src)
   {
   document[img_name].src = img_src;
   }



