jQuery(document).ready(function() { if( false === jQuery.browser.msie || (jQuery.browser.msie && jQuery.browser["version"] > 6.0) ) { var root = "../index.html", is_category = false, current_category = false; if( -1 != location.pathname.search(/\/category\//) ) { is_category = true; var pattern = /\/category\/([\d]{1,2})/, result = pattern.exec(location.pathname), current_category = result[1]; } $("#more_form").show(); $("#sites_kategorija_form #submit, #sites_kategorija_form #submit_button, #pobjednici_category_submit").hide(); var ori_height = $(".slideout").height(); $(".slideout").css({"height" : 0}).hide(); $("#link").bind("focus", function(){ slideout(); }); $("#more_form").bind("click", function(){ slideout(); }); $("#sites_kategorija_form #kategorija").bind("change", function() { if( "" != $(this).val() ) window.location = $(this).val(); }); $("#pobjednici_category").bind("change", function() { if( "" != $(this).val() ) window.location = root + '../http/www.vidi.hr/pobjednici/MS_19.html' + $(this).val() + '../http/www.vidi.hr/MS_3.html'; else window.location = root + '../http/www.vidi.hr/pobjednici/MS_19.html'; }); $("#nominirani_home, #slider li").height(130); $("#slider li").css({"padding" : 0, "border" : "none"}); $("#slider").easySlider( { nextText: '>', prevText: '<', speed: 600, auto: false, pause: 3000, controlsFade: false }); function slideout() { $(".ui-selectmenu-menu").hide(); $("#more_form").animate({"height" : 0, "opacity" : 0}, 300); $(".slideout").animate({"height" : ori_height}, 300); setTimeout('$("#more_form").remove();$(".ui-selectmenu-menu").show();', 300); if( !(jQuery.browser.msie && jQuery.browser["version"] >= 7.0 && jQuery.browser["version"] < 8.0) ) setTimeout('$(".slideout").css({"height" : "auto"})', 300); } /* submit site */ /* character counter */ function count() { $("#counter_info").html("Broj preostalih znakova za opis: " + (1000 - $("#opis").val().length)); }; if( 0 < $("#opis").length ) { count(); $("#opis").bind("keyup blur focus change", function(){count()}); } /* process form */ $("#submit_form #submit").removeAttr("disabled"); $("#submit_form input:not(#submit), #submit_form textarea, .ui-selectmenu").css({"border" : "1px solid #222222"}); //$("#autor, #autor_link").css({"padding" : "10px 16px"}); $("#submit_form #submit").bind("click", function() { if( jQuery.browser.msie && jQuery.browser["version"] <= 6.0 ) return true; if( $("#ajax_info").length == 0 ) $("#submit_form").append('
 
'); $c = $("#ajax_info"); $c.hide().html('

Molimo priÄŤekajte trenutak...

').css({"height" : "auto"}).fadeIn(200); $data = $("#submit_form").serialize(); $("#submit_form #submit").attr("disabled", true); $("#submit_form input:not(#submit), #submit_form textarea, .ui-selectmenu").css({"border" : "1px solid #222222"}); $.post( $("#submit_form").attr("action") + "/ajax/", $data, function(json) { if( false !== json.errors && undefined != json.errors && "undefined" != json.errors ) { var message = json.errors; if( -1 == message.search("Hm,") && -1 == message.search("promijenite") ) { var errors = message.split(""); errors = errors[0].split("###"); var missing = errors[0]; var invalid = errors[1]; if( "none" != missing ) { var m = missing; missing = new Array(m); if( -1 != m.search(",") ) missing = m.split(", "); for( i=0; i" + message + "

").css({"height":"auto"}).fadeIn(200); } else if( undefined != json.message && "undefined" != json.message ) { $c.hide().html("

" + json.message + "

").css({"height":"auto"}).fadeIn(200); } else { $("#content").fadeOut(200); $("#content").html(json.form).fadeIn(200); $("html head title").html("Hvala Vam na nominaciji! - VIDI Web Top 100 2009"); } $("#submit_form #submit").removeAttr("disabled"); }, "json"); return false; }); /* vote */ /*$("a.vote-link").live("click", function() { if( $working ) return false; var $working = true; var message = ""; var c = "ajax_info"; var vlid = $(this).attr("id"); var ts = 3000; var tf = 1000; var vlc = $(this).attr("class").replace(/vote-link /, ""); vlc = vlc.replace(/\s/g, ""); var that = this, this_vote_count = jQuery(that).parent().children(".votecount"), this_votes = jQuery(this_vote_count).text().match(/[\d]+/), this_votes = this_votes[0]; $(".vote-link").fadeOut(200); setTimeout("$('.vote-link').css({'visibility' : 'visible'})", 200); if( $("#" + c).length == 0 ) { $("body").append('

Molimo priÄŤekajte trenutak...

'); h = $("#" + c).height(), w = $("#" + c).width(), hn = "-" + (h/2) + "px", wn = "-" + (w/2) + "px"; $("#" + c).css({"top" : "50%", "left" : "50%", "height" : h + "px", "width" : w + "px", "marginTop" : hn, "marginLeft" : wn }).fadeIn(); } $.getJSON( $(this).attr("href") + "/ajax", function(json) { message = "Vaš glas je uspješno zabilježen! Hvala!"; // errors if( false !== json.error ) { switch(json.error) { case "already_voted_site" : message = "Već ste glasovali za ovu stranicu"; break; case "already_voted_category" : message = "Već ste glasovali u ovoj kategoriji"; break; case "site_not_exist" : message = "Stranica kojoj želite dati glas ne postoji!"; break; case "logged_out" : message = "Morate biti prijavljeni kako biste mogli glasovati!"; break; default : message = json.error; } ts = 2000; tf = 500; if( "multiple_categories" == json.error ) { message = "

Ova stranica je prijavljena u više kategorija, molimo kliknite na ime kategorije u kojoj želite glasovati. Hvala!

"; message += "

" + json.sitecatslinks + "

"; $(".box_link.ajax").live("click", function() { var pattern = /vote\/category\/([\d]{1,2})\/ajax/; var result = pattern.exec($(this).attr("href")); var votedcat = "category-" + result[1]; $.getJSON( $(this).attr("href"), function(json) { message = "Vaš glas je uspješno zabilježen! Hvala!"; if( false !== json.error ) { switch(json.error) { case "already_voted_site" : message = "Već ste glasovali za ovu stranicu"; break; case "already_voted_category" : message = "Već ste glasovali u ovoj kategoriji"; break; case "site_not_exist" : message = "Stranica kojoj želite dati glas ne postoji!"; break; case "logged_out" : message = "Morate biti prijavljeni kako biste mogli glasovati!"; break; default : message = json.error; } } else { json.error = false; $working = false; } $("#" + c).fadeOut(150).html("

" + message + "

").css({"width" : "auto", "height" : "auto"}); h = $("#" + c).height(); w = $("#" + c).width(); hn = "-" + (h/2) + "px"; wn = "-" + (w/2) + "px"; $("#" + c).css({"top" : "50%", "left" : "50%", "marginTop" : hn, "marginLeft" : wn }).fadeIn(150); setTimeout("$('#" + c + "').fadeOut(" + tf + ");", ts); // no errors if( false == json.error || "" == json.error ) { $("." + votedcat).removeClass().remove(); setTimeout("$('.vote-link:not(." + votedcat + ")').css({'visibility' : ''}).fadeIn(200);", ts); } // error and single page else if( ! is_category ) { setTimeout("$('.vote-link').css({'visibility' : ''}).fadeIn(200);", ts); } $working = false; }); return false; }); } } $("#" + c).hide().html("

" + message + "

").css({"width" : "auto", "height" : "auto"}); h = $("#" + c).height(); w = $("#" + c).width(); hn = "-" + (h/2) + "px"; wn = "-" + (w/2) + "px"; $("#" + c).css({"top" : "50%", "left" : "50%", "marginTop" : hn, "marginLeft" : wn }).fadeIn(); if( "multiple_categories" != json.error ) setTimeout("$('#" + c + "').fadeOut(" + tf + ");", ts); // no errors if( false == json.error || "" == json.error ) { jQuery(this_vote_count).html( jQuery(this_vote_count).html().replace( this_votes, String(Number(this_votes)+1) ) ); $(that).removeClass().remove(); if( ! is_category ) setTimeout("$('.vote-link:not(." + vlc + ")').css({'visibility' : ''}).fadeIn(200);", ts); } // basic errors else if( "multiple_categories" != json.error ) { setTimeout("$('.vote-link').css({'visibility' : ''}).fadeIn(200);", ts); $working = false; } }); return false; });*/ jQuery("#twitter_feed").newsticker(7000); } var scrolling = false; function scroll_to_top(time) { /* var x = (document.all) ? window.screenLeft : window.screenX; window.scroll(x,0); */ if( "undefined" == typeof(time) ) time = 500; if(scrolling == false) { scrolling = true; $('html,body') .animate( {scrollTop : $('#scrollToHere').offset().top}, time, "linear", function() { scrolling = false; } ); } } if( 0 < jQuery("a.colorbox").length && jQuery.fn.colorbox ) jQuery("a.colorbox").colorbox(); });