/*
footer functions
~ onclick="function();return false"
function privacy() {
    newwindow = window.open('privacy.php','terms','"toolbar=no,address=no,left=100,top=100,status=no,width=620,height=450,scrollbars=yes,resizable=yes"')
}
function terms() {
	newwindow = NewWindow('terms/LNA_Site_Terms-11-39-21.pdf','terms',300,300,'yes');
}
*/
function openPopup(url, width, height, scroll){
	//newwindow = NewWindow(url, url, width, height, scroll);
	createOverlayPopup(url, width, height, scroll);
	return false;
}

function closePopup(){
	//self.close();	
	parent.removeOverlay();
	return false;
}

function linkClosePopup(url){
	//self.close();	
	//parent.location=url;
	parent.window.open(url)
	parent.removeOverlay();
	return false;
}

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings =
	'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	win = window.open(mypage,myname,settings)
}

function copyright(brand){
  var year = new Date().getFullYear ();
  document.write('&copy; ' + brand + ' ' + year);
}

var flag = 0;

/*
Flash  function to open  a poup window
*/

function getLink(url, parameters){
	eval("newWindow = window.open(url" + parameters + ")");
}
	

function terms() {
	newwindow = NewWindow('terms.php','terms',500,600,'yes');
}

function privacy() {
	newwindow = NewWindow('privacy.php','privacy',500,600,'yes');
}

function termsUse() {
	newwindow = NewWindow('termsUse.php','termsUse',500,600,'yes');
}

function faqs() {
	newwindow = NewWindow('faq.php','faqs',500,600,'yes');
}

function register() {
	newwindow = NewWindow('forms/register.php','register',500,350,'no');
}

function submitDailyChallenge(){
	
	var $answer = $("#answer").val();
	var $responseMessage = '<div id="message" class="error">asdfasdf</div>';
	
	
	//Enter into database.
	
	//Get Response.
	
	//Confirm
	
	//Error
	
	$("#messageContainer").html($responseMessage);
	$("#messageContainer").show('slow');
	
}

function submitTeamVote($teamid){
}

function showFileSubmitField() {
	$selectedFile = $("#extensionid").val();
	$fileType = '';
	$selectedFile = parseInt($selectedFile);

	switch($selectedFile)
	{
	case 1: // youtube
	  $fileType = 'link';
	  $fileTip = '<span>Enter the URL of your Youtube video (eg. http://au.youtube.com/watch?v=ABCDEFGH).<br /><a class="cluetip-map" href="../help/cluetip_youtube.htm" rel="../help/cluetip_youtube.htm">Find out how</a>.</span>';
	  break;    
	case 2: // slideshare
	  $fileType = 'link';
	  $fileTip = '<span>Enter the Wordpress Embedd Code of your slideshow<br />(eg. [slideshare id=12345678&doc=title-here-12345678-2&w=425])<br /><a class="cluetip-map" href="../help/cluetip_slideshare.htm" rel="../help/cluetip_slideshare.htm">Find out how</a>.</span>';
	  break;
	case 3: // google
	  $fileType = 'link';
	  $fileTip = '<span>Enter the URL of your Google Doc<br />(eg. http://docs.google.com/ccc?key=ABCDEFGH&hl=en)</span>';
	  break;
	case 4: // ms word
	  $fileType = 'Filedata';
	  $fileTip = '<span>Select a Word Document from your local computer and click "submit".<br />Word Documents must have the file extension ".doc" or ".docx".</span>';
	  break;
	case 5: // ms excel
	  $fileType = 'Filedata';
	  $fileTip = '<span>Select a Excel Spreadsheet from your local computer and click "submit".<br />Excel Spreadsheets must have the file extension ".xls" or ".xlsx".</span>';
	  break;
	case 6: // ms powerpoint
	  $fileType = 'Filedata';
	  $fileTip = '<span>Select a Powerpoint Presentation from your local computer and click "submit".<br />Powerpoint Presentations must have the file extension ".ppt" or ".pptx".</span>';
	  break;
	case 7: // web page
	  $fileType = 'link';
	  $fileTip = '<span>Enter the URL of a web page<br />(eg. http://www.domain.com).</span>';
	  break;
	case 8: // PDF document
	  $fileType = 'Filedata';
	  $fileTip = '<span>Select an Adobe Acrobat (PDF) file from your local computer and click "submit".</span>';
	  break;
	default:
	  $fileType = '';
	  $fileTip = '';
	  break;
	}
	
	if($fileType == 'link'){
		$("#fileLabel").hide();
		$("#fileField").hide();
		$("#linkLabel").show();
		$("#linkField").show();
		$("#uploadsubmit").show();
		$("#fileTip").empty();
		$("#fileTip").append($fileTip);
		$('a.cluetip-map').cluetip({showTitle: false, width: 425,sticky: true,activation: 'click'});
	}else if($fileType == 'Filedata'){
		$("#fileLabel").show();
		$("#fileField").show();
		$("#linkLabel").hide();
		$("#linkField").hide();
		$("#uploadsubmit").show();
		$("#fileTip").empty();
		$("#fileTip").append($fileTip);
	}else if($fileType == ''){
		$("#fileLabel").hide();
		$("#fileField").hide();
		$("#linkLabel").hide();
		$("#linkField").hide();
		$("#uploadsubmit").hide();
		$("#fileTip").empty();
		$("#fileTip").append($fileTip);
	}	
}

/*show postgraduate warning.*/

function showGraduateWarning() {
	
	degreeType = $("#degreetypeid").val();
	degreeType = parseInt(degreeType);
	if(degreeType == 2){
		$("li#graduatewarning").fadeIn();
	}else{
		$("li#graduatewarning").fadeOut();
	}
}

/*TEAM PROFILE SUBMISSION*/

function hideAllPlayers(){
	$('.playerhide').hide();
	$('.playerButtons').removeClass('selected');
}

function showPlayer($ID){
	hideAllPlayers();
	$('#playerButton-'+$ID).addClass('selected');
	$('#playerContainer-'+$ID).fadeIn('slow');
}

function setflag(val){
	 flag = parseInt(val);
}

function checkflag(url){
	
	if(flag == 1){
		var warning = confirm("You are about to continue without saving changes.")
		if(warning){
			window.location = url;
		}
	}else{
		window.location = url;
	}

}

function querySt(ji) {
hu = window.location.search.substring(1);
gy = hu.split("&");
for (i=0;i<gy.length;i++) {
ft = gy[i].split("=");
if (ft[0] == ji) {
return ft[1];
}
}
}
