function getRef(obj){

        return (typeof obj == "string") ?

        document.getElementById(obj) : obj;

}



function setClassName(obj, className)

{

	if(obj == 'fontsizecontainer')

	{

		var today = new Date();

		var expire = new Date();

		expire.setTime(today.getTime() + 3600000*24*365);

 	

		document.cookie = "fontclass=" + className + ";expires=" 

			+ expire.toGMTString() + ";path=/";

	}

		

   	getRef(obj).className = className;

}



var currentFilmSortIndex = null;

function displaySortedFilms(containerIndexDisplay, containerIndexHide){

	if(containerIndexHide != null) {
		document.getElementById('filmSortContainer' + containerIndexHide).className = 'filmsHidden';

		document.getElementById('filmSortHeading' + containerIndexHide).className = '';

	}
	document.getElementById('filmSortContainer' + containerIndexDisplay).className = 'filmsShowed';

	document.getElementById('filmSortHeading' + containerIndexDisplay).className = 'active';

	currentFilmSortIndex = containerIndexDisplay;
}



function displayTab(tabNameDisplay, tabNameHide1){

	document.getElementById(tabNameHide1).className = 'tabHidden';

	document.getElementById(tabNameDisplay).className = 'tabShowed';

	if (tabNameDisplay == 'descrip' || tabNameDisplay == 'quests'){

	var cText1 = (tabNameDisplay == 'descrip')? 'first active' : 'active';

	var cText2 = (tabNameHide1 == 'descrip')? 'first' : '';

	document.getElementById('resource2_'+tabNameDisplay).className = cText1;

	document.getElementById('resource2_'+tabNameHide1).className = cText2;

	}

	if (tabNameDisplay == 'sortlist' || tabNameDisplay == 'filminfo'){

	document.getElementById('resource2_'+tabNameDisplay).className = 'active';

	document.getElementById('resource2_'+tabNameHide1).className = '';

	}

}



function getCheckedValue(radioObj) {

	if(!radioObj)

		return "";

	var radioLength = radioObj.length;

	if(radioLength == undefined)

		if(radioObj.checked)

			return radioObj.value;

		else

			return "";

	for(var i = 0; i < radioLength; i++) {

		if(radioObj[i].checked) {

			return radioObj[i].value;

		}

	}

	return "";

}



function submitForm(myform)

{

	

	

	var today = new Date();

	var expire = new Date();

	expire.setTime(today.getTime() + 3600000*24*365);

	

	document.cookie = "version=" + getCheckedValue(document.forms[myform].elements['version']) + ";expires=" 

	+ expire.toGMTString() + ";path=/";

	document.cookie = "format=" + getCheckedValue(document.forms[myform].elements['format']) + ";expires=" 

	+ expire.toGMTString() + ";path=/";

	document.forms[myform].submit();

}



function doPassVar(sendText){

	if(window.videoPlayer) window.document["videoPlayer"].SetVariable("myVar", sendText);

	if(document.videoPlayer) document.videoPlayer.SetVariable("myVar", sendText);

}

function pmwindow(pmID, lang)
{
	window.open("./popup.php?id=" + pmID + "&lang=" + lang,"Promo Window","width=465,height=400,directories=no,toolbar=no,location=no,menubar=no,scrollbars=no,resizable=yes,status=no");
}
