$(document).ready(function(){
	
	// Contact Form
	$("#contactform").validate();
	
	$.extend($.validator.messages, {
		required: " &laquo; Dieses Feld ist ein Pflichtfeld.",
		email: "G&uuml;ltige E-Mail Adresse ben&ouml;tigt."
	});
	
	var options = { 
        target:        '#thankyou',   // target element(s) to be updated with server response 
        beforeSubmit:  showRequest,  // pre-submit callback 
        success:       showResponse  // post-submit callback 
    }; 
	
	// pre-submit callback 
	function showRequest(formData, jqForm, options) { 
		var queryString = $.param(formData); 
		return true; 
	} 
	 
	// post-submit callback 
	function showResponse(responseText, statusText)  { 
	} 
	
	
 
    // bind form using 'ajaxForm' 
    $('#contactform').ajaxForm(options);
	
	//Cufon Font Replacement					   
	Cufon.replace('h1');
	Cufon.replace('h2');
	Cufon.replace('h4');
	Cufon.replace('h5');
	Cufon.replace('caption');
	Cufon.replace('.tabs li a');
	
	//Software Links
	$("a.software").fancybox({
		'frameWidth': 	380,
		'frameHeight': 	560
	});
	
	//Tabs	
	var currentTab = 0; // Starting Tab

	function openTab(clickedTab) {
		var thisTab = $(".wrapper_tabs .tabs a").index(clickedTab);
		$(".wrapper_tabs .tabs li a").removeClass("active");	
		$(".wrapper_tabs .tabs li a:eq("+thisTab+")").addClass("active");
		$(".wrapper_tabs .tabs_content").hide();
		$(".wrapper_tabs .tabs_content:eq("+thisTab+")").show();
		currentTab = thisTab;
	}
		
	$(".wrapper_tabs .tabs li a").click(function() { 
		openTab($(this)); return false; 
	});
	
	$(".wrapper_tabs .tabs li a:eq("+currentTab+")").click()
	
		//Price
		var select = '#select_price';
		$(select).attr('selectedIndex', '0');
		$(select).change(function () {
			$(select + ' option').each(function () {
				$('.' + this.value).hide();
			});
			$(select + ' option:selected').each(function () {
				$('.' + this.value).show();
			});
		}).change(); 
		
		//Input Button
		$('input #form_button').hover(function() {
	  	$(this).addClass('bloody_ie_form_button');
			}, function() {
	  	$(this).removeClass('bloody_ie_form_button');
	});

}); 
