﻿// JScript File
var gwinPopUp

/******************************************************/
/***** IMAGE FUNCTIONS ********************************/
/******************************************************/
function uf_ChangePic_Menu(aoMenu, asMouseOut){
	var asPath = '/Main/Images/Menu/'
	var asMenuId = aoMenu.id
	var asMenuName = asMenuId.replace(/img/,"")

	if(asMouseOut == 'True'){
		var asPic1 = asPath + asMenuName + '2.jpg'
	}
	else{
		var asPic1 = asPath + asMenuName + '.jpg'
	}

	if(aoMenu){
		aoMenu.src = asPic1
	}
}

function uf_SetImgSrc(aoImg, asImgName, asPath){
	if(aoImg){
		aoImg.src = asPath + asImgName
	}
}

function uf_HomeThumb(asDivID, asMouseOut){
	if(asMouseOut == 'True'){
		document.getElementById(asDivID + "a").style.display = "block"
		document.getElementById(asDivID + "b").style.display = "none"
		document.getElementById(asDivID + "c").style.display = "block"
		document.getElementById(asDivID + "d").style.display = "none"		
	}
	else{
		document.getElementById(asDivID + "a").style.display = "none"
		document.getElementById(asDivID + "b").style.display = "block"
		document.getElementById(asDivID + "c").style.display = "none"
		document.getElementById(asDivID + "d").style.display = "block"

	}
}

function uf_MenuHover(asDivID, asMouseOut){
	if(asMouseOut == 'True'){
		document.getElementById(asDivID + "1").style.display = "block"
		document.getElementById(asDivID + "2").style.display = "none"
	}
	else{
		document.getElementById(asDivID + "1").style.display = "none"
		document.getElementById(asDivID + "2").style.display = "block"
	}
}

/******************************************************/
/***** POP-UP FUNCTIONS *******************************/
/******************************************************/
function uf_PicPopUp(asContent,asImage,asLifestyle,asGroup,asPastEvent){

	gwinPopUp = window.open("/Main/PicPopup.aspx?content="+asContent+"&mediapath="+asImage+"&lifestyle="+asLifestyle+"&group="+asGroup+"&pastevents="+asPastEvent,
							"gwinPopUp","top=100px,left=100px,width=499px,height=497px,scrollbars=no,menubar=no," +
							"resizable=no,titlebar=no,location=no",false)

	gwinPopUp.focus();
}

function uf_ClosePopUp(){
	window.close();
}

function uf_PopUpOnLoad(){
	var lsLifestyle = uf_GetQueryString("lifestyle")
	var lsGroup = uf_GetQueryString("group")
	var height
	var width
	
	if(lsLifestyle=="SA Studios" && lsGroup=="Videos"){
		height = 471;
		width = 326;
	}
	else{
		var height = document.getElementById("imgAd").height + 250;
		var width = document.getElementById("imgAd").width + 100;
	}

	//Set focus to "Next" link so that pressing ENTER will load next media.
	document.getElementById("laNext").focus();

	//Resize window accdg to media size
	window.resizeTo(width, height);
}

function uf_GetQueryString(lsQueryName) {
	var lsQueryStrings = window.location.search.substring(1);
	var listQueryStrings = lsQueryStrings.split("&");

	for (i=0;i<listQueryStrings.length;i++) {
		listQuery = listQueryStrings[i].split("=");
		if (listQuery[0] == lsQueryName) {
			return listQuery[1];
		}
	}
}

/******************************************************/
/***** HOME PAGE FUNCTIONS ****************************/
/******************************************************/
function uf_SetTdBorderColor(asColor){
	if(document.getElementById("tdYTubeTop")){
		document.getElementById("tdYTubeTop").style.borderColor = asColor
	}
	if(document.getElementById("tdYTubeBottom")){
		document.getElementById("tdYTubeBottom").style.borderColor = asColor
	}

}

/******************************************************/
/***** OTHER FUNCTIONS ********************************/
/******************************************************/
function uf_ChangeClass(aoObject, asCssClass){
	if(aoObject){
		aoObject.className = asCssClass
	}
}

function uf_LinkHover(asImgID, asMouseOut){
	if(asMouseOut == 'True'){
		document.getElementById(asImgID + "1").style.display = "block"
		document.getElementById(asImgID + "2").style.display = "none"
	}
	else{
		document.getElementById(asImgID + "1").style.display = "none"
		document.getElementById(asImgID + "2").style.display = "block"
	}
}

/******************************************************/
/***** SIGN UP ****************************************/
/******************************************************/
function verifyRequired() {
  if (document.icpsignup["fields_email"].value == "") {
    alert("Please enter your Email address.");
    return false;
  }
  if (document.icpsignup["fields_fname"].value == "") {
    alert("Please enter your First Name.");
    return false;
  }
	return true;
}

