function getObject(name) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	
	return (isIE) ? window[name] : document[name];
}

$(function(){
	window.defaultStatus="Design + Programming by FEINHEIT kreativ studio · www.feinheit.ch";
});

$(document).ready(function() {
	$('form.vote').submit(function() {
		var vote = $('input[name="vote"]', this).attr('value');
		var ip = $('input[name="ip"]',this).attr('value');
		var csrf = $('input[name="csrfmiddlewaretoken"]', this).attr('value');
		params = {'vote': vote, 'ip': ip, 'csrf': csrf}
		votingBox = getObject('flash-titel');
		if (votingBox == undefined) {
			$('div#voting-feedback div#feedback-install-flash').fadeIn();
		}
		else {
			votingBox.sendVoting(params);
		}
		$('input[name="vote"]',this).addClass('highlight');
		return false;
	});
	$('div#nav>ul>li.trailer>a').attr('target','_blank');
});

function flashCallback(success) {
	if(success) {

		window.location.href = 'thank/?v=' + $('input[name="vote"].highlight').attr('value');
	}
	else {
		$('div#voting-feedback div#feedback-already-voted').fadeIn();
		$('a.vote-text-button').fadeOut();
	}
}

