/*
 * Copyright (c) 2010 
 * -------------------------------
 * powered by revaxarts.com (http://revaxarts.com)
 * original filename: rx.js
 * filesize: 6490 Bytes
 * last modified: Fri, 30 Jul 2010 11:30:01 +0200
 *
 */
$(document).ready(function () { easing = "myeasing"; $("#bignav li").bind('click', function(){ section = $(this).attr('class'); $('#headernav a').removeClass('selected'); $('#nav_'+section).addClass('selected'); $.google('/'+section); $.setLocation('/'+section); return false; }); $("a[href^='http']").bind('click', function(){ loc = $(this).attr('href'); section = '/extern='+loc; $.google(section); if($(this).attr('rel') == 'popup'){ window.open($(this).attr('href')); return false; } setTimeout("location.href = loc;",500); return false; }); $("a[href^='#']").bind('click', function(){ if($(this).attr('href') != '#'){ section = location.pathname+'/'+$(this).attr('href').substr(1); $.google(section); } return false; }); $("a[href^='/']").bind('click', function(){ if($(this).attr('href') != '#'){ section = $(this).attr('href').substr(1); $.google(section); } if($(this).attr('rel') == 'popup'){ window.open($(this).attr('href')); return false; } return false; }); $('#formbutton').bind('click', function(){ var data = $("form").serialize(); if($(this).attr('disabled')){ return false; } $(this).attr('disabled','disabled'); $.post("ajax.php?id=form", { func: "sendform", data:data }, function(data){ if(data.trace){ alert(unescape(data.trace))}; if(!data.success){ if(data.msg){ msg = $('#msg').val(); $('#msg').val(unescape(data.msg)).css('background-color','#FB6B12').attr('disabled','disabled'); setTimeout("$('#msg').css('background-color','#F9F5EA').val(msg).removeAttr('disabled').focus().select();$('#formbutton').removeAttr('disabled');",3000); }; if(data.email){ email = $('#email').val(); $('#email').val(unescape(data.email)).css('background-color','#FB6B12').attr('disabled','disabled'); setTimeout("$('#email').css('background-color','#F9F5EA').val(email).removeAttr('disabled').focus().select();$('#formbutton').removeAttr('disabled');",3000); }; if(data.name){ name = $('#name').val(); $('#name').val(unescape(data.name)).css('background-color','#FB6B12').attr('disabled','disabled'); setTimeout("$('#name').css('background-color','#F9F5EA').val(name).removeAttr('disabled').focus().select();$('#formbutton').removeAttr('disabled');",3000); }; }else{ $('#formbutton').removeAttr('disabled'); $('#form').before(data.html); $('#form').remove(); } }, "json"); return false; }); jQuery.extend({ init: function() { $(".topbtn").hide(); if(location.pathname == '/'){ $("#bignav").jFlow({ slides: "#slidebox", controller: ".bignavbutton", slideWrapper : "#slidewrapper", selectedWrapper: "selected", width: 960, height: 450, easing: easing, duration: 250, prev: ".jFlowPrev", next: ".jFlowNext" }); if(location.hash){ setTimeout('$(".bignavbutton:eq("+$.getLocation(true)+")").trigger("click");',10); }else{ $('#nav_start').addClass('selected'); } $('.slider').show(); $('.slider').nivoSlider({ controlNav:false, directionNav:false, pauseOnHover:false, effect:'sliceDown' }); } $('#nav_start, #fnav_start').bind('click',function(){ $(".bignavbutton:eq(0)").trigger("click"); return false; }); $('#nav_kompetenzen, #fnav_kompetenzen, #how').bind('click',function(){ $("#kompetenzen").removeAttr('id'); $(".bignavbutton:eq(1)").trigger("click"); return false; }); $('#nav_profil, #fnav_profil, #who').bind('click',function(){ $("#profil").removeAttr('id'); $(".bignavbutton:eq(2)").trigger("click"); return false; }); $('#nav_kontakt, #fnav_kontakt, #con').bind('click',function(){ $("#kontakt").removeAttr('id'); $(".bignavbutton:eq(3)").trigger("click"); return false; }); $.getTwitterStatus(); setInterval("$.getTwitterStatus()",30000); }, google: function(section) { if(typeof pageTracker == 'object'){ pageTracker._trackPageview(section); } }, getTwitterStatus: function(id) { $.post("/ajax.php?id=twitter", { func: "getLastTweet", id:id }, function(data){ if(data.trace){ alert(unescape(data.trace))}; if(data.tweet){ $('#twittermsg').html((data.tweet.replace(/=#/g, '=%23'))); }else{ $('#twittermsg').html('nicht viel'); }; if(data.created){ $('#twittertime').html(data.created); $('#twittertime').attr('title',data.createddate); }; }, "json"); }, getLocation: function(number) { loc = ""+location.href.split('#')[1]; if(number){ i=0; $("#bignav li").each(function(){ if(loc == '/'+$(this).attr('class')){ loc = i; } i++; }); } return ""+loc; }, setLocation: function(section) { if(!section || section == ""){section = "";} location.href = "http://"+location.hostname+"/"+location.search+"#"+section; }, setCookie: function(k, v, e) { if(!section || section == ""){section = "";} var a = new Date(); a = new Date(a.getTime() +1000*60*60*24*365); document.cookie = k+'='+v+'; expires='+a.toGMTString()+'; '; }, getCookie: function(k) { var a = document.cookie.split(';'); var c = new Array(); for(i=0;i<a.length;i++){ v=a[i].substring(a[i].search('=')+1); if(k == jQuery.trim(a[i].substring(0,a[i].search('=')))){ return v; } } return false; } }); jQuery.extend( jQuery.easing,{ myeasing: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; } }); $.init(); }); 