var dom = (document.getElementById) ? true : false;
var nn4 = (document.layers) ? true : false;
var ie = (document.all) ? true : false;
var ie4 = (!dom && ie) ? true : false;
var moz = (dom && (navigator.appName=="Netscape")) ? true : false;
var opr = (dom && window.opera) ? true : false;
var op7 = (opr && (navigator.userAgent.indexOf("Opera 7") > 0 || navigator.userAgent.indexOf("Opera/7") >= 0)) ? true : false;

var hintsObj = null;

function moveHintsN(e) {

	if (hintsObj == null) return;
	if (nn4) {
		document.layers['hints'].left = e.pageX + 15;
		document.layers['hints'].top = e.pageY - 120;
		document.layers['hints'].visibility = "show"
	} else if (moz || op7) {
		document.getElementById('hints').style.left = window.pageXOffset + e.clientX + 15 + "px";
		document.getElementById('hints').style.top = window.pageYOffset + e.clientY - 120 + "px";
		document.getElementById('hints').style.visibility = "visible";
	}
}

function hideHintsN(e) {

	if (hintsObj == null) return;
	document.releaseEvents(Event.MOUSEMOVE);
	document.releaseEvents(Event.MOUSEOUT);
	document.onmousemove = null;
	document.onmouseout = null;
   	if (nn4) {
		document.layers['hints'].visibility = "hide";
		document.layers['hints'].left = 0;
		document.layers['hints'].top = 0;
    } else if (moz || op7) document.getElementById('hints').style.visibility = "hidden";
    hintsObj = null;
}


function moveHints() {

	if (opr || moz || nn4 || (hintsObj == null)) return;

    xoff = 0;
    yoff = 0;
	if (dom || ie) {
		if (dom) q = document.getElementById(hintsObj);
		else q = document.all[hintsObj];
		while (q) {
			xoff += q.offsetLeft;
			yoff += q.offsetTop;
			q = q.offsetParent;
		}
		xoff += window.event.offsetX + 15;
		yoff += window.event.offsetY + -120;
	}

    if (dom) {
		document.getElementById('hints').style.left = xoff;
		document.getElementById('hints').style.top = yoff;
	} else if (ie4) {
		document.all['hints'].style.left = xoff;
		document.all['hints'].style.top = yoff;
	}
}

function hideHints() {

	if (opr || moz || nn4 || (hintsObj == null)) return;

	if (dom) document.getElementById('hints').style.visibility = "hidden";
		else if (ie4) document.all['hints'].style.visibility = "hidden";
    hintsObj = null;
}



function showHints(obj,head,text,lang,slang,janre,coast,cd_class) {

	if ((opr && !op7) || (text == "")) return;

  	contents = "<TABLE border=1 cellspacing=0 cellpadding=5 width=400 class=\'hintshead\'><TR><TD><TABLE cellspacing=0 cellpadding=2 border=1 align=center width=100%><TR><TD align=center><B>" + head + "</B></TD></TR></TABLE><TABLE cellspacing=0 cellpadding=2 border=1 align=center width=100%><TR><TD width=20%><TABLE><TR><TD><B><I>Язык: </I></B></TD><TD>" + lang + "</TD></TR><TR><TD><B><I>Титры: </I></B></TD><TD>" + slang + "</TD></TR><TR><TD><B><I>Жанр: </I></B></TD><TD>" + janre + "</TD></TR><TR><TD><B><I>Тип диска: </I></B></TD><TD>" + cd_class + "</TD></TR><TR><TD><B><I>Стоимость: </I></B></TD><TD>" + coast + "р.</TD></TR></TABLE></TD><TD width=80% valign=top><B><center>Описание: </center></B>" + text + "</TD></TR></TABLE></TD></TR></TABLE>";
	
	hintsObj = obj;
	if (dom) document.getElementById('hints').innerHTML = contents;
	else if (nn4) {
			document.layers['hints'].document.open();
			document.layers['hints'].document.write(contents);
			document.layers['hints'].document.close();
		}
	else if (ie4) document.all['hints'].innerHTML = contents;

	if (nn4 || moz || op7) {
		document.captureEvents(Event.MOUSEMOVE);
		document.captureEvents(Event.MOUSEOUT);
		document.onmousemove = moveHintsN;
		document.onmouseout = hideHintsN;
		return;
	}
    if (dom || ie) {
		moveHints();
		if (dom) document.getElementById('hints').style.visibility = "visible";
			else if (ie4) document.all['hints'].style.visibility = "visible";
    }
}



function startTimer()
	{
	timerRun=-1;var time=new Date()
	hours=time.getHours()
	mins=time.getMinutes()
	secs=time.getSeconds()
	closeTime=hours*3600+mins*60+secs
	closeTime+=timeout
	Timer()
	}
function Timer()
	{
	var time=new Date()
	hours=time.getHours()
	mins=time.getMinutes()
	secs=time.getSeconds()
	curTime=hours*3600+mins*60+secs
	if(curTime<closeTime)
		{
		count=closeTime-curTime
		document.timerform.timerwin.value=count
		if(document.timerform.timerwin.value == "")
		stopTimer()
		if(timerRun)
		window.setTimeout("Timer()",1000)
		}
	}
function stopTimer()
	{
	timerRun=0;
	}

function addtofav()
	{
	if(window.external)
		window.external.AddFavorite('http://www.animestuff.ru/')
	else
		alert('Нажмите кнопку OK, а после этого Ctrl+D. и возврвщайтесь к нам!')
	}

function SendForm()
	{
	if (((document.all.eng_name.value == "") && (document.forms.add.eng_name.value.length < 3)) && ((document.all.e_rus_name.value == "") && (document.forms.add.e_rus_name.value.length < 3)))
		{
		alert('Введите Английское или Русское название фильма(не менее 3х знаков)');
		document.all.eng_name.focus();
		return false;
		}
	return true;
}
		
function Oth_enable()
	{
	if(document.all.other_j.checked)
		{
		document.all.other_janr.disabled = false;
		document.all.janr.disabled = true;
		}
		else
		{
		document.all.other_janr.disabled = true;
		document.all.janr.disabled = false;
		}
	}
	
function group_enable()
	{
	if(document.all.new_group.checked)
		{
		document.all.other_group.disabled = false;
		document.all.group.disabled = true;
		}
		else
		{
		document.all.other_group.disabled = true;
		document.all.group.disabled = false;
		}
	}

var newWin

function wow()
	{
	location.href='/korzina_anime/'
	newWin.close()
	}
function wow2()
	{
	newWin.close()
	}
function wow3()
	{
	location.href='/korzina_anime/udalit_vse/'
	}
function AddCart(FilmKod,num)
	{
	newWin = window.open('/korzina_anime/dpbavit-'+FilmKod+'/','newWin','toolbar=no,status=no,resizable=yes,width=450,height='+num+',top=100,left=100');
	}
function delCart(FilmKod,id_del)
	{
	location.href = '/korzina_anime/udalit-' + FilmKod + '-' + id_del + '/'
	}
