//added schools number
var addedSchools = 0;

jQuery(document).ready(function(){
    //show hide archive files div
     var prev = null;
    jQuery("a[rel='expand']").bind('click', function() {
        if (prev != this.lang){
            jQuery("ul[title='"+prev+"']").hide();
        }
        prev = this.lang;
        jQuery("ul[title='"+this.lang+"']").toggle();
        return false;
    });

    //show popup login form
    jQuery("a[rel='popup']").bind('click', function() {
        // Nyro models deletes the div after it's used. That's why we need to clone and append it again after showing this DIV
        var popupDiv = jQuery("#popup").clone();

        jQuery("#popup").show();
        jQuery.nyroModalManual({
            content: jQuery("#popup"),
            minWidth: 448,
            minHeight: 238,
            autoSizable: false,
            galleryLinks: '',
            width: 448,
            height: 238
        });

        //append it now - when original is deleted
        jQuery("#body").append(popupDiv);

        return false;
    });

/*
    //show or hides subjects li
    jQuery("#showSubjects").bind('click', function() {
        jQuery(".subjects").toggle();

        return false;
    });

        //toogle classes in registraion and profile form
    jQuery("#showClasses").bind('click', function() {
        jQuery(".showClasses").toggle();
        return false;
    });
*/
    //show or hides prijavnice
    jQuery("#semPrijave").bind('click', function() {
        jQuery(".semPrijave").toggle();

        return false;
    });

    //adding teacher schools for registration form
    jQuery("#addSchool").bind('click', function() {
        //addNewSchool
        jQuery(".addNewSchool").toggle();
        return false;
    });

    //toogle classes in registraion and profile form
    jQuery("#obvestila").bind('click', function() {
        jQuery(".sendAddress").toggle();
    });

    if (jQuery("#obvestila:checked").val()){
        jQuery(".sendAddress").toggle();
    }

    //seminar formjQuery('#radio_form input:radio:checked').val();
    jQuery("input[name='payer']").bind('click', function() {
        if (this.value == "placnik_sam"){
            jQuery(".showPersonInputs").show();
        }else{
             jQuery(".showPersonInputs").hide();
        }
    });
    //change home link to student home page ig on student site
    changeHomePageLink();

});

function changeHomePageLink(){
    var link = document.location.toString() ; //url

    //if not on student pages return false
    if (link.indexOf("ucenci") == -1){
        return false;
    }
    jQuery("a[title='domov']").each(function(){
        this.href="za_ucence";
    });
}

jQuery(document).ready(function(){
    if (jQuery('#sidebar .list').length>0){
        /*CYCLE for NEWS*/
        jQuery('#sidebar .list').cycle({
            fx:    'scrollDown',
            width: 174,
            height: 75,
            delay: -1000
        });
    }
});