$(document).ready(function() 
    { 


$('#call_me_container .submit').hover(
  function () {
    $(this).css('background-image','url(/images/static/knap_active.png)');
  }, 
  function () {
    $(this).css('background-image','url(/images/static/knap_passive.png)');
  }
);



$('#siteSearchInput').keyup(function(e) {			
    if(e.keyCode == '13') {
 	if ($('#siteSearchInput').val() != 'Search the Site' && $('#siteSearchInput').val() != '') 
    	{
           	clickSearch($('#siteSearchInput').val());
                e.preventDefault();   
	}
     }        		
     });   
});

function clickSearch(v) {
    if (v != 'Search the Site' && v != '') 
    {

        window.location.href = "/service-navigation/search.aspx?search=" + encodeURI(v) + "&page=1";
        return true;
    }
}






function SubmitExtendedContactForm(type)
{


var ExtendedFormName = document.getElementById("ExtendedFormName" );
//var ExtendedFormEmail= document.getElementById("ExtendedFormEmail" );
var ExtendedFormTlf= document.getElementById("ExtendedFormTlf" );
var ExtendedFormMessage= document.getElementById("ExtendedFormMessage" );

var msg = "Du skal udfylde flg. felter:\n\n";
var alertflag = false;

if(ExtendedFormName.value == "")
{
msg = msg + "- Navn\n";
alertflag = true;
}
if(ExtendedFormTlf.value == "")
{
msg = msg + "- E-mail\n";
alertflag = true;
}

if(ExtendedFormMessage.value == "")
{
msg = msg + "- Besked\n";
alertflag = true;
}



if(alertflag)
{alert(msg );}
else
{


var ExtendedFormContainer = document.getElementById("ExtendedFormContainer");

jQuery.post("/voscontact.ashx", { navn: ExtendedFormName.value, message: ExtendedFormMessage.value, email: ExtendedFormTlf.value}, // Ajax call script, sending the letter as a param
		function(data)
{
		

alert(data);	
//tween_call_me('call_me_container');
//$("#call_me_container").hide();

alert("Question recieved!");
$("#call_me_container").hide('blind','',500);
				$("#AskUs").removeClass('expanded',0);
				contactshown=false;


}
);






}

}



function tween_call_me(el_id)
{
	if(el_id)
	{
		var elem	= $(el_id);
alert(elem.style);
		var end		= ( parseInt(elem.style.height) > 0 ? 0 : 200 );
		elem.style.height	= ( !elem.style.height ? 0 + 'px' : elem.style.height );
		elem.style.display	= 'block';
		JSTweener.addTween(elem.style, {
				time: 0.5,
				transition: 'easeOutQuart',
				height: end,
				suffix: {
					height: 'px'
				}
		});
	}
}



