/////////////////////////////////////////////////////////////////
////**** All scripts used to show and hide popups (divs) ****////
/////////////////////////////////////////////////////////////////

//Closes popup and stops movie
function ClosePopup(divName,movieName)
{
	document.getElementById(divName).style.display = "none";
	document.getElementById("DarkDiv").style.display = "none";
	stopmovie(movieName);
}

//Opens popup and plays movie
function OpenPopup(divName,movieName)
{
	CloseUsefulWords();
	document.getElementById(divName).style.display = "block";
	document.getElementById("DarkDiv").style.display = "block";
	playmovie(movieName);
}

//Hide example
function CloseExample(ExampleDivID)
{
	//Hide example popup
	document.getElementById("DarkDiv").style.display = "none";
	document.getElementById(ExampleDivID).style.display = "none";
}

//Replace current example with the next one
function NextExample(ExampleDivID, QuestionID, CurrentExample, HowMany)
{
	//Hide current example
	CloseExample(ExampleDivID);
	
	//Get next example in series
	var popupname = "";
	if(CurrentExample == HowMany)
	{
		popupname = "ExamplePopup1Question" + QuestionID;
	}
	else
	{
		popupname = "ExamplePopup" + (Number(CurrentExample) + 1) + "Question" + QuestionID;
	}
	
	//Show popup
	document.getElementById("DarkDiv").style.display = "block";
	document.getElementById(popupname).style.display = "block";
}

//Show random example
function ShowExample(QuestionID,HowMany)
{
	//Hide useful words
	CloseUsefulWords();

	//Pick a random number from 1 to HomeMany
	var randnum = (Math.round((Math.random()*(HowMany-1))+1));
	
	//Build example popup name
	var popupname = "ExamplePopup" + randnum + "Question" + QuestionID;
	
	//Show popup
	document.getElementById("DarkDiv").style.display = "block";
	document.getElementById(popupname).style.display = "block";
}

//Open settings popup
function OpenSettings(AccountID)
{
	var url = "AccountSettings.aspx?aid=" + AccountID;
	window.open([url], "Settings", "width=300,height=300,scrollbars=no");
}

//Opens the tour popup
function ShowTour()
{
	var url = "tour/";
	window.open([url], "Tour", "width=740,height=600,scrollbars=yes");
}

//Opens dating tips and advice
function OpenDatingTips()
{
	var url = "tour/";
	window.open([url], "Tour", "width=740,height=600,scrollbars=yes");
}

//Open Terms and Conditions popup
function OpenTerms()
{
	window.open("LegalPopup.aspx#Terms", "Legal", "width=700,height=500,scrollbars=yes");
}

//Open Privacy popup
function OpenPrivacy()
{
	window.open("LegalPopup.aspx#Privacy", "Legal", "width=700,height=500,scrollbars=yes");
}

//Open Preparation popup
function OpenPrep()
{
	window.open("preparation.htm", "Prep", "width=750,height=500,scrollbars=yes, resizable=yes");
}

//Show Useful Words (floating div)
function OpenUsefulWords()
{
	document.getElementById("DarkDiv").style.display = "block";
	document.getElementById("UsefulWordsPopup").style.display = "block";
}

//Show Inspiring Words div in the page
function OpenInspiringWordsInPage()
{
	document.getElementById("InspiringWordsInPage").style.display = "block";
}

//Hide Useful Words
function CloseUsefulWords()
{
	document.getElementById("DarkDiv").style.display = "none";
	document.getElementById("UsefulWordsPopup").style.display = "none";
	document.getElementById("InspiringWordsInPage").style.display = "none";
}