function loadStuff()
{

$("a").click(function () {
var link = $(this).attr('href');

$(".menu a").each(function(){ 
$(this).css("color","#939393");
});

if(link == "#work" || link == "#work-view" || link == "#work-view-home")
{
$("a.work").css("color","#3a6bb0");
}

if(link == "#home")
{
$("a.home").css("color","#3a6bb0");
}

if(link == "#about")
{
$("a.about").css("color","#3a6bb0");
}
if(link == "#contact")
{
$("a.contact").css("color","#3a6bb0");
}
			
});

$('#navigation,#logotop,#quicklinks').localScroll({target: '#content',queue:true,hash:true,axis:'xy'});
			$("#destaques a.verproj").click(function(){loadWork(this,"work-view-home");});
			$('.destaque-nav').localScroll({target: '#destaques',queue:true,hash:false});
		  	$("#frmcontacto").validate({meta:"validate",submitHandler:function(form) { enviarContacto(form); }});
			$("#twitter_div").getTwitter({
					userName: "inezborges",
					numTweets: 1,
					loaderText: "Loading tweets...",
					slideIn: false,
					showHeading: false,
					headingText: "Latest Tweets",
					showProfileLink: false
			});
			
			$("#quicklinks a").click(function(){
			$("#here").text($(this).attr('title'));
			});
						
			$("#logotop a").click(function(){
			$("#here").text($(this).attr('rel'));
			});
			
			$(".menu a").click(function(){
			$("#here").text($(this).attr('title'));			
			});
}

function loadWork(a,div)
{
$("#"+div).html('<img src="/media/imgs/ajax-loader.gif" alt="Loading..." border="0" />');
var id = $(a).attr("rel");
$.ajax({
url: "projecto.php?id="+id,
cache: true,
success: function(html){
$("#"+div).html(html);
}
});
}

function loadWorks(a)
{
$("#work").html('<img src="/media/imgs/ajax-loader.gif" alt="Loading..." border="0" />');
var id = $(a).attr("rel");
$.ajax({
url: id,
cache: true,
success: function(html){
$("#work").html(html);
}
});

}

function enviarContacto(form)
{
var dados = $(form).serialize();
$("#contact-msg").html('<img src="/media/imgs/ajax-loader.gif" alt="Loading..." border="0" />');
var msg = '';

$.ajax({
type: "POST",
url: "/ci/index.php/welcome/index/enviar",
cache: false,
data: dados,
success: function(html){
//if(html == "1"){
msg = "Your message has been sent. We will contact you shortly";	
$("#nome").val('');
$("#correio").val('');
$("#assunto").val('');
$("#mensagem").val('');
//}else{
//msg = "It was not possible to send your message, please try again.";
//}
$("#contact-msg").html(msg);
}
});
return false;
}

(function(){
  anchor = document.location.hash, handlers = [];

  jQuery.extend({
    anchorHandler: {
      add: function(regexp, callback) {
        if (typeof(regexp) == 'object') {
          jQuery.map(regexp, function(arg){
            args = {r: arg[0], cb: arg[1]};});}
        else  args = {r: regexp, cb: callback};
        handlers.push(args);
        return jQuery.anchorHandler;
      }
    }
  })(document).ready(function(){
    jQuery.map(handlers, function(handler){
      match = anchor.match(handler.r) && anchor.match(handler.r)[0] || false;
      if (match) handler.cb.apply(this, [match, (anchor || false)]);});});
})();

