function openWindow(page) {
	av_win = window.open(page, "av_win");
	return false;
}
function getFlashMovieObject(movieName) {
	if (window.document[movieName]) {
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1) {
		if (document.embeds && document.embeds[movieName])
			return document.embeds[movieName];
	} else { // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
		return document.getElementById(movieName);
	}
}

/***** HYVES *****/
function post_question_hyves (question) {
	myRef = window.open('hyves.php?q='+question, 'myPopup');
}
function hy_callback(status) {
	var flashMovie = getFlashMovieObject("cards");

	if (status == 'success') {
		flashMovie.success('hyves');
	} else {
		flashMovie.fail('hyves');
	}
}

function post_result_hyves (score, rank) {
	var status = score + ' wat goed is voor de rang: ' + rank + '!';
	myRef = window.open('hyves.php?s='+status, 'myPopup');
}
function hy_callback2(status) {
	// resultaat wegschrijven naar database
	if (status == 'success') {
		alert('Je mag nog een keer meedoen');
		document.location.href = "contest.php?f=1";
	}
}


/***** TWITTER *****/
function post_question_twitter (question) {
	myRef = window.open('twitter.php?q='+question, 'myPopup');
}
function tw_callback(status) {
	var flashMovie = getFlashMovieObject("cards");

	if (status == 'success') {
		flashMovie.success('twitter');
	} else {
		flashMovie.fail('twitter');
	}
}
function post_result_twitter (score, rank) {
	var status = 'Testing: ' + score + ', ' + rank;
	myRef = window.open('twitter.php?s='+status, 'myPopup');
}
function tw_callback2(status) {
	// resultaat wegschrijven naar database
	if (status == 'success') {
		alert('Je mag nog een keer meedoen');
		document.location.href = "contest.php?f=1";
	}
}

/***** NETLOG *****/
function post_question_netlog(question) {
	myRef = window.open('http://www.netlog.com/go/logs/shouts/view=friends&origin=external&message=Speel de Final Fantasy XIII Quiz en win een reis naar Tokio! Check http://www.ff13.nl', 'myPopup');

	var flashMovie = getFlashMovieObject("cards");

	//if (status == 'success') {
		flashMovie.success('netlog');
	//} else {
	//	flashMovie.fail('netlog');
	//}
}

function post_result_netlog (score, rank) {
	myRef = window.open('http://www.netlog.com/go/logs/shouts/view=friends&origin=external&message=Speel de Final Fantasy XIII Quiz en win een reis naar Tokio! Check http://www.ff13.nl', 'myPopup');

	//if (status == 'success') {
		alert('Je mag nog een keer meedoen');
		document.location.href = "contest.php?f=1";
	//}
	// anders moet je iets anders doen
}