/*!
 * Custom JavaScript Library v1.0
 *
 * Copyright 2010, Bastian Hager
 *
 */


//
//(function($){  
//
//    $.fn.s3Slider = function(vars) {       
//        
//        var element     = this;
//        var timeOut     = (vars.timeOut != undefined) ? vars.timeOut : 4000;
//        var current     = null;
//        var timeOutFn   = null;
//        var faderStat   = true;
//        var mOver       = false;
//        var items       = $("#" + element[0].id + "Content ." + element[0].id + "Image");
//        var itemsSpan   = $("#" + element[0].id + "Content ." + element[0].id + "Image span");
//            
//        items.each(function(i) {
//    
//            $(items[i]).mouseover(function() {
//               mOver = true;
//            });
//            
//            $(items[i]).mouseout(function() {
//                mOver   = false;
//                fadeElement(true);
//            });
//            
//        });
//        
//        var fadeElement = function(isMouseOut) {
//            var thisTimeOut = (isMouseOut) ? (timeOut/2) : timeOut;
//            thisTimeOut = (faderStat) ? 10 : thisTimeOut;
//            if(items.length > 0) {
//                timeOutFn = setTimeout(makeSlider, thisTimeOut);
//            } else {
//                console.log("Poof..");
//            }
//        }
//        
//        var makeSlider = function() {
//            current = (current != null) ? current : items[(items.length-1)];
//            var currNo      = jQuery.inArray(current, items) + 1
//            currNo = (currNo == items.length) ? 0 : (currNo - 1);
//            var newMargin   = $(element).width() * currNo;
//            if(faderStat == true) {
//                if(!mOver) {
//                    $(items[currNo]).fadeIn((timeOut/6), function() {
//                        if($(itemsSpan[currNo]).css('bottom') == 0) {
//                            $(itemsSpan[currNo]).slideUp((timeOut/6), function() {
//                                faderStat = false;
//                                current = items[currNo];
//                                if(!mOver) {
//                                    fadeElement(false);
//                                }
//                            });
//                        } else {
//                            $(itemsSpan[currNo]).slideDown((timeOut/6), function() {
//                                faderStat = false;
//                                current = items[currNo];
//                                if(!mOver) {
//                                    fadeElement(false);
//                                }
//                            });
//                        }
//                    });
//                }
//            } else {
//                if(!mOver) {
//                    if($(itemsSpan[currNo]).css('bottom') == 0) {
//                        $(itemsSpan[currNo]).slideDown((timeOut/6), function() {
//                            $(items[currNo]).fadeOut((timeOut/6), function() {
//                                faderStat = true;
//                                current = items[(currNo+1)];
//                                if(!mOver) {
//                                    fadeElement(false);
//                                }
//                            });
//                        });
//                    } else {
//                        $(itemsSpan[currNo]).slideUp((timeOut/6), function() {
//                        $(items[currNo]).fadeOut((timeOut/6), function() {
//                                faderStat = true;
//                                current = items[(currNo+1)];
//                                if(!mOver) {
//                                    fadeElement(false);
//                                }
//                            });
//                        });
//                    }
//                }
//            }
//        }
//        
//        makeSlider();
//
//    };  
//
//})(jQuery);  
//
//
//
//
//examples=[]
//Randomcolor=""
//selected=false;


// Start Menubar
		$(document).ready(function() {
			$("#menu li a").wrapInner( '<span class="out"></span>' ).append( '<span class="bg"></span>' );
			$("#menu li a").each(function() {
				$( '<span class="over">' +  $(this).text() + '</span>' ).appendTo( this );
			});
			$("#menu li a").hover(function() {
				$(".out",	this).stop().animate({'top':	'45px'},	250); // move down - hide
				$(".over",	this).stop().animate({'top':	'0px'},		250); // move down - show
				$(".bg",	this).stop().animate({'top':	'0px'},		120); // move down - show
			}, function() {
				$(".out",	this).stop().animate({'top':	'0px'},		250); // move up - show
				$(".over",	this).stop().animate({'top':	'-45px'},	250); // move up - hide
				$(".bg",	this).stop().animate({'top':	'-45px'},	120); // move up - hide
			});
		});
// End Menubar

/* ------------------------------------------------------------------------
	s3Slider
	
	Developped By: Boban KariÅ¡ik -> http://www.serie3.info/
        CSS Help: MÃ©szÃ¡ros RÃ³bert -> http://www.perspectived.com/
	Version: 1.0
	
	Copyright: Feel free to redistribute the script/modify it, as
			   long as you leave my infos at the top.
------------------------------------------------------------------------- */

//$('#slider').s3Slider({ 
//      timeOut: 5000,
//       
//   });
//
//			
//    randomcolor();
//    $("h1,h2,.up").FontEffect({
//        outline             :true,
//        outlineColor1       :"rgb(100,100,130)",
//        outlineColor2       :"rgb(100,100,130)",
//        outlineWeight       :2,
//        shadow              :true,
//        shadowColor         :"rgb(100,100,130)",
//        shadowOffsetTop     :3,
//        shadowOffsetLeft    :3,
//        shadowBlur          :1,
//        shadowOpacity  :1
//        });
//    $(".ititle").FontEffect({
//        outline:true,
//        outlineWeight       :2,
//        outlineColor1:"#fcc"
//        });
//    $(".example").each(function(i){
//        var ind=i
//        var a=$("#style"+ind).html()
//        uuu=$("#options"+ind)
//        aaa=uuu.html()
//        b=0
//        examples[ind]={
//            options :$("#options"+ind).html().replace(/[\n\s]/gi,""),
//            style   :a.substring(a.indexOf("{")+1,a.lastIndexOf("}")),
//            html    :$("#example"+ind),
//            top     :$("#example"+ind).offset().top-50
//            }
//        var str=""
//        str+="<a href='#' onclick='$(\".codebox:visible\").toggle();return false'>X</a>"
//        str+="JAVASCRIPT<xmp class='xmpcode'>$('#example"+ind+"').FontEffect({\n    "+examples[ind].options.replace(/\,/gi,",\n    ")+"\n})</xmp>"
//        str+="CSS<xmp class='xmpstyle'>#example"+ind+"{"+examples[ind].style+"}</xmp>"
//        str+="HTML<xmp class='xmphtml'><"+examples[ind].html[0].tagName+" id='example"+ind+"'>\n    "+examples[ind].html[0].innerHTML+"\n</"+examples[ind].html[0].tagName+"></xmp>"
//        $("#example"+ind).after($("<div></div>").addClass("codebox").html(str).attr("id","example"+i+"src"))
//        })
//    chkposition()
//    $(window).scroll(function(){
//        chkposition()
//        })
//        
//    // sandbox onload
//    cpick=$.farbtastic('#picker');
//    $(".colore")
//        .each(function(){cpick.linkTo(this)})
//        .focus(function(){
//            if(selected){
//                apply()
//                }
//            if(selected!=this){
//                cpick.linkTo(this);
//                $(this).after($("<a href='#' onclick='apply();return false'>Apply</a>"))
//                $("#boxpicker").css({top:$(this).position().top-200+"px",left:$(this).position().left+"px"}).show()
//                selected=this
//                }
//            })
//    $("#sandboxtext").css({
//        margin:"30px 0px 0px 80px",
//        fontFamily:"Verdana",
//        color:"#77c",
//        fontSize:"90px"
//        })
//    $('#addcommento').ajaxForm({beforeSubmit:controlla,success:addmessage});
//    });
//    //
//function randomcolor(){
//    Randomcolor=("rgb("+Math.round(Math.random()*255)+","+Math.round(Math.random()*255)+","+Math.round(Math.random()*255)+")")
//    $("#xmp16").html("<xmp>$('#example16').redrawFE({gradientColor:'"+Randomcolor+"'})</xmp>")
//    }
//function chkposition(){
//    var wst=$(window).scrollTop()
//    var whe=$(window).height()
//    $(examples).each(function(ii){
//        if(examples[ii].top < wst+whe && examples[ii].top > wst){
//            activateExample(ii)
//            }
//        })
//    }
//function activateExample(iii){
//    eval('$("#example"+iii).FontEffect({'+examples[iii].options+'})')
//    examples[iii].top=99999999999
//    $("#example"+iii)
//        .click(function(e){
//            $(".codebox:visible").toggle("fast")
//            var a=$(".codebox:visible")
//            var b=$("#example"+iii+"src")
//            if(((a.length>0)?a[0].id:"")!=((b)?b[0].id:""))$(b).toggle("slow")
//            })
//        .css("cursor","pointer")
//    }
//    
//// sabdbox functions
//function apply(){
//    var nome=selected.name
//    var valore=cpick.color
//    $("#boxpicker").hide()
//    $(selected).next().remove()
//    selected=false
//    switch(nome){
//        case "fontColor":
//            $("#sandboxtext").css("color",valore)
//            break;
//        case "backgroundColor":
//            $("#sandbox").css("backgroundColor",valore)
//            break;
//        default:
//            eval('$("#sandboxtext").redrawFE({'+nome+':"'+valore+'"})');
//        }
//    return(false);
//    }
//
//function changeop(ob){
//    var nome=ob.name
//    if(ob.type.indexOf("select")!=-1){
//        var valore=ob.options[ob.selectedIndex].value
//        if(valore=="Other..."){
//            var valore = window.prompt("Insert a value for the "+nome+" option","default");
//            }
//        if(nome=="fontFamily"|| nome=="fontSize"|| nome=="marginTop"|| nome=="marginLeft"){
//            $("#sandboxtext").css(nome,valore)
//            return false;
//            }
//        if(nome=="backgroundImage"){
//            $("#sandbox").css("backgroundImage","url("+valore+")")
//            return false;
//            }
//        }
//    if(ob.type.indexOf("checkbox")!=-1){
//        $("#"+nome+"_o").toggle()
//        if($("#ojs :checked").length>0){
//            var valore=ob.checked
//            }
//        else{
//            $("#sandboxtext").removeFE(true)
//            return false;
//            }
//        }
//    if(ob.type.indexOf("text")!=-1){
//        var valore=ob.value
//        if(nome=="sandtext"){
//            var appo=$("#sandboxtext")
//            if($(appo).hasClass("JQFE")){appo=$("#sandboxtext div[class*=JQFE]")}
//            $(appo).html(valore)
//            return false;
//            }
//        if(isNaN(valore)){valore="'"+ob.value+"'"}
//        }
//    eval('$("#sandboxtext").redrawFE({'+nome+':'+valore+'})')
//    }

//function controlla(testo){
//    if(testo[0].value=="Your name") testo[0].value=""
//    if(testo[1].value){
//        var s=testo[1].value
//        s=s.replace(/à/gi,"&agrave;")
//        s=s.replace(/è/gi,"&egrave;")
//        s=s.replace(/ì/gi,"&igrave;")
//        s=s.replace(/ò/gi,"&ograve;")
//        s=s.replace(/ù/gi,"&ugrave;")
//        s=s.replace(/é/gi,"&eacute;")
//        s=s.replace(/£/gi,"&#163;")
//        s=s.replace(/ç/gi,"&#231;")
//        s=s.replace(/°/gi,"&#176;")
//        s=s.replace(/§/gi,"&#167;")
//        s=s.replace(/\n/gi,"[br]")
//        //s=s.replace(/\s/gi,"&nbsp;")
//        testo[1].value=s
//        $("#nuovocommento").html("Wait please....")
//        }
//    else{
//        alert("Insert message text");
//        return(false);
//        }
//    }
//function addmessage(testo,stato){
//    if(stato=="success"){
//        if(testo.indexOf("syntax error")==-1){
//            vafie=testo.split("||")
//            str=""
//            str+='<div class="commento"><p class="uname">'
//            str+=vafie[0];
//            str+=" <span class='grigio'> Your message </span></p><p>"+vafie[1].replace(/\[br\]/gi,"<br>")+"</p></div>"
//            str+="<div class='fondocommento'>&nbsp;</div>"
//            $("#nuovocommento").html(str).fadeIn()
//            }
//        else{
//            alert("Errors while sending, retry or write to fontborder[@t]iofo.it!")
//            }
//        }
//    }
    
//$('headline').FontEffect({
//    outline:true,
//    outlineColor1:"#000000",
//    outlineColor2:"#000000",
//    outlineWeight:3,
//    shadow:true,
//	shadowColor:"#000",
//    shadowOffsetTop :3,
//    shadowOffsetLeft:3,
//    shadowBlur      :1,
//    shadowOpacity   :1
//    })
//
// 

