

	Cufon.replace('h1.cufon');
	Cufon.replace('h2.cufon');
	Cufon.replace('h3.cufon');
	
	
	$(document).ready(function() {

	    /*
	     * BEGIN CHECK INVITATION CODE
	     */
	
	    if ($('#checkInvitationCode').html()!="") {
	        $('#checkInvitationCode').fadeTo("fast",0.6);
	        $('#checkInvitationCode')
	            .bind("mouseenter",function() { $(this).fadeTo("normal",1); })
	            .bind("mouseout",function() {$(this).fadeTo("normal",0.6); })
	            .click(function() {
	                var erg = checkInvitationCode(true);
	                return false;
	            });
	            $('#bos_invitation_code').change(function() {
	                $('input#bos_invitation_code').removeClass("correct").removeClass("incorrect");
	            });
	        $('form .dosubmit').click(function() {
	           var erg = checkInvitationCode();
	           if (erg==true) {
	                $('form.registrationform').submit();
	           }
	           return false;
	        });
	    }
	
		$('.faq strong a').click(function() {
			//if ($(this).attr("class")=="active") {
				$(' > p',$(this).parent().parent()).slideToggle();
				/*$(this).removeClass("active");
			} else {
				$(' > p',$(this).parent().parent()).show();
				$(this).addClass("active");
			}*/
			return false;
		});
	
	    /*
	     * END CHECK INVITATION CODE
	     */
	     
	     
	     
	     
	     
	     $(".countryselectdd").html($(".countryselectdd option").sort(function (a, b) {
		    return a.text == b.text ? 0 : a.text < b.text ? -1 : 1
		}));
	});	
	
	
	
function checkInvitationCode(checkIt) {
    if(!checkIt) {
        checkIt = false;
    }
    if ($('#email').val()=="") {
        alert($('#language_702').text());
        return false;
    } else if($('input#bos_invitation_code').val()=="" && checkIt==true) {
        alert($('#language_703').text());
        return false;
    }
    if($('input#bos_invitation_code').val()=="" && checkIt==false) {
        return true;
    }
    var erg = false;
    $.ajax({
        url: "/ajaxcalls/checkUserInvitationCode.html",
        data: {code:$('input#bos_invitation_code').val(),email:$('#email').val()},
        success: function(data) {
            if (data.result=='ok') {
                if (checkIt) { alert($('#language_704').text());                 
                     $('input#bos_invitation_code').addClass("correct");
                 }
                 erg = true;
            } else {
                alert($('#language_705').text());
                $('input#bos_invitation_code').addClass("incorrect");
                erg = false;
            }
        },
        async: false,
        type: 'post',
        dataType: 'json'
    });
    return erg;
}
	
