jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
	}
}


$(document).ready(function() {
$.preloadImages("bk.jpg");
$("#message2").center() ;
$("#wform").center() ;

$("#notify").click(function() {
$('#wform').Grow(500);
$("#notify").Puff(500);
$("#notify").empty();
}) ;

$("#sNao").click(function() {
closesimnao();
}) ;


$("#sSim").click(function() {
$("#quest").SlideOutUp(500);
$("#nform").SlideInUp(500);
}) ;


$("#main").SlideInLeft(500);
$("#place").animate({
  opacity: 'show'
}, "slow", "easeout");

$("#Mcontacto").click(function(){
contacto();
}); // end #Mcontacto

$("#Mlocalizacao").click(function(){
localizacao();
}); // end #Mcontacto

$("#pLocalizacao").click(function(){
$("#pLocalizacao").BlindUp(500);
});






    var options = { 
        beforeSubmit:  showRequest,  
        success:       showResponse, 
	    global: false,
        url: "form.php",      
        type:      'post'      
    }; 
 

    $('#fcontacto').ajaxForm(options); 



    var options2 = { 
        beforeSubmit:  showRequest,  
        success:       showResponse, 
	    global: false,
        url: "notify.php",      
        type:      'post'      
    }; 
 

    $('#formnot').ajaxForm(options2); 









});


function localizacao(){
	urchinTracker ('/EmDesenvolvimento/Localizacao');
$("#pLocalizacao").BlindDown(500);
$("#pContacto").css("display","none");
}

function contacto(){

urchinTracker ('/EmDesenvolvimento/Contacto');
$("#bar").animate({
  opacity: 'show'
}, "slow", "easein");


	$("#pLocalizacao").css("display","none");
$("#pContacto").BlindDown(500);
}





function closesimnao(){
$('#wform').Puff(500);
$("#notify").Puff(500);
$("#notify").empty();
}






 
// pre-submit callback 
function showRequest(formData, jqForm, options) { 
    var queryString = $.param(formData); 
    $('#msg').html('<img src="loading.gif" width="30" height="30" />'); 
  // alert('About to submit: \n\n' + queryString); 

    return true;  
} 

function showResponse(responseText, statusText)  { 
 $('#msg').empty();   
   /*alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +  
        '\n\nThe output div should have already been updated with the responseText.'); 
  */
   eval(responseText);
} 


function showError()  { 

}

function movex(){
$('#main').Shake(2);
setTimeout("movex();",10000);
}

function movenotify(){
$('#notify').Bounce(120);

setTimeout("movenotify();",3000);
}

movenotify();
function warning(msg){
//	alert(msg);
$('#message').html("<div class=\"warning\">"+msg+":</div>");
$('#message').Grow(500);
    $('#message')

    .insertAfter( $('#main') )

    .fadeIn('slow')

    .animate({opacity: 1.0}, 3000)

    .fadeOut('slow', function() {

     

    });

 

}




function msg(msg){
//	alert(msg);
$('#message2').html("<div class=\"info\">"+msg+":</div>");
$('#message2').Grow(500);
    $('#message2')

    .insertAfter( $('#main') )

    .fadeIn('slow')

    .animate({opacity: 1.0}, 3000)

    .fadeOut('slow', function() {

     

    });

 

}

movex();