function Orderedby(){
	document.forms['nav_form'].page.value='';
	document.forms['nav_form'].searchstring.value='';
	document.forms['nav_form'].Type.value=document.forms['nav_form'].ByGenre.value;
	document.forms['nav_form'].sort.value='';
	document.forms['nav_form'].dir.value='';
	document.forms['nav_form'].submit();
}
function reverseOrder(strPrev,strType)
{
	var dir = ((strType == 'ave' || strType == 'christookeysrating') ? 'DESC' : 'ASC');
	if(strPrev == strType)
	{dir = ((strType == 'ave' || strType == 'christookeysrating') ? 'ASC' : 'DESC');}
	document.forms['nav_form'].page.value='';
	document.forms['nav_form'].searchstring.value='';
	document.forms['nav_form'].Type.value=document.forms['nav_form'].ByGenre.value;
	document.forms['nav_form'].sort.value=strType;
	document.forms['nav_form'].dir.value=dir;
	document.forms['nav_form'].submit();
}

function SPreverseOrder(strPrev,strType)
{
	thisdir=document.forms['nav_form'].dir.value;

	var dir = ((strType == 'ave' || strType == 'christookeysrating') ? 'DESC' : 'ASC');
	if(strPrev == strType)
	{dir = (thisdir=="DESC") ? 'ASC' : 'DESC';}

	document.forms['nav_form'].page.value='';
	document.forms['nav_form'].searchstring.value='';
	document.forms['nav_form'].Type.value=document.forms['nav_form'].ByGenre.value;
	document.forms['nav_form'].sort.value=strType;
	document.forms['nav_form'].dir.value=dir;
	document.forms['nav_form'].submit();
}
function RelreverseOrder(strPrev,strType)
{
	thisdir=document.forms['nav_form'].dir.value;
	var dir = ((strType == 'avt' || strType == 'ctr' || strType=='year') ? 'DESC' : 'ASC');
	if(strPrev == strType)
	{dir = (thisdir=="DESC") ? 'ASC' : 'DESC';}
	document.forms['nav_form'].sort.value=strType;
	document.forms['nav_form'].dir.value=dir;
	document.forms['nav_form'].submit();
}

function CheckParametr(){
 	if (document.forms['search_form'].SearchParam.value=="" ||
 		document.forms['search_form'].SearchParam.value=="Search parametr")
 		{
		alert('Please enter some text first');
 		return false;
 		}
 	else{
 		document.forms['search_form'].submit();
 		return false;
 		}
}
function Login_Form_Validator(theForm) {
	if(theForm.Email.value == "") {
		alert("\"Email\" is required.");
		theForm.Email.focus();
		return (false);
	}
	if(theForm.Password.value == "") {
		alert("\"Password\" is required.");
		theForm.Password.focus();
		return (false);
	}
	return (true);
}

function CheckFields(){
	if (document.forms['form1'].Title.value=="" &&
		document.forms['form1'].Director.value=="" &&
		document.forms['form1'].Writer.value=="" &&
		document.forms['form1'].Above_CT.value=="" &&
		document.forms['form1'].Below_CT.value=="" &&
		document.forms['form1'].Above_AC.value=="" &&
		document.forms['form1'].Below_AC.value=="" &&
		document.forms['form1'].ActorName.value=="" &&
		document.forms['form1'].Category.value=="" &&
		document.forms['form1'].Year.value=="" &&
		document.forms['form1'].Country.value=="")
		{
			alert('Please enter some text first');
			return false;
		}
	else {
			return true;
		}
}

function ClearFields(){

  var form, elements, i, elm; 
  formIdent="form1";
  form = document.getElementById 
    ? document.getElementById(formIdent) 
    : document.forms[formIdent]; 
	if (document.getElementsByTagName)
	{
		elements = form.getElementsByTagName('input');
		for( i=0, elm; elm=elements.item(i++); )
		{
			if (elm.getAttribute('type') == "text")
			{
				elm.value = '';
			}
		}
	}

	// Actually looking through more elements here
	// but the result is the same.
	else
	{
		elements = form.elements;
		for( i=0, elm; elm=elements[i++]; )
		{
			if (elm.type == "text")
			{
				elm.value ='';
			}
		}
	}
			return true;

}
	



function mm_openBrWindow(theURL, winName, features) {
  window.open(theURL, winName, features);
}

function mm_swapImgRestore() {
 var i,x,a=document.mm_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function mm_preloadImages() {
	var d=document; if(d.images){ if(!d.mm_p) d.mm_p=new Array();
	var i,j=d.mm_p.length,a=mm_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.mm_p[j]=new Image; d.mm_p[j++].src=a[i];}}
}

function mm_swapImage() {
	var i,j=0,x,a=mm_swapImage.arguments; document.mm_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=mm_findObj(a[i]))!=null){document.mm_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function mm_popupMsg(msg) {
 alert(msg);
}

function mm_openBrWindow(theURL, winName, features) {
  window.open(theURL, winName, features);
}

function mm_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=mm_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function mm_goToURL() {
  var i, args=mm_goToURL.arguments; document.mm_returnValue=false;
  for(i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function close_window()
{
	window.close();
}
