// Negativ JavaScript Document

var busy = false, timer, loadedImages = [], gallery, progress, bar;
var slide = 0;//tracks which slide is showing
var slidePause = 3000; //length of time to keep a slide at 1 opacity
function $E(A,B){
    return($(B)||document).getElement(A);
}

window.addEvent('domready', function() {
	if ($('logout')) $('logout').addEvent('click',function(){prelogout()});
	
	if ( $('moreInfoName') ){
		if ($('moreInfoName').get('value') == ''){
			$('moreInfoName').set('value','Név');
			$('moreInfoName').set('style','color:#555;font-style: italic;margin-top:4px;width:120px;');
		}
		
		if ($('moreInfoTel').get('value') == ''){
			$('moreInfoTel').set('value','Telefonszám');
			$('moreInfoTel').set('style','color:#555;font-style: italic;margin-top:4px;width:120px;');
		}
		
		$('moreInfoName').addEvent('click',function(){
			if ($('moreInfoName').get('style') != 'margin-top: 4px;'){
				$('moreInfoName').set('value','');
				$('moreInfoName').set('style','margin-top:4px;width:120px;');
			}
		});
		$('moreInfoName').addEvent('fucus',function(){
			if ($('moreInfoName').get('style') != 'margin-top: 4px;'){
				$('moreInfoName').set('value','');
				$('moreInfoName').set('style','margin-top:4px;width:120px;');
			}
		});
		
		$('moreInfoTel').addEvent('click',function(){
			if ($('moreInfoTel').get('style') != 'margin-top: 4px; width: 120px;'){
				$('moreInfoTel').set('value','');
				$('moreInfoTel').set('style','margin-top:4px;width:120px;');
			}
		})
		
		$('moreInfoTel').addEvent('focus',function(){
			if ($('moreInfoTel').get('style') != 'margin-top: 4px; width: 120px;'){
				$('moreInfoTel').set('value','');
				$('moreInfoTel').set('style','margin-top:4px;width:120px;');
			}
		})
	}
	
});

function prelogout(){
	var c = parseInt($('basketcounter').innerHTML);
	if (c > 0)
		if (confirm("F I G Y E L E M !\nAz ön kosarában jelenleg van "+c+" olyan termék, aminek a megrendelését még nem küldte el.\nBiztosan kilép?")) document.location = '/logout/';
		else document.location = '/kosar/';
	else document.location = '/logout/';
}

function AddBookmark() {
    if (navigator.appName=="Netscape") {
        alert( 'Az oldal könyvjelzőkhöz adásához, katt a "Könyvjelzőkre" és "Könyvjelző hozzáadására" vagy nyomd le a következő billentyűkombinációt: Ctrl+D.' );
    }
    else if (parseInt(navigator.appVersion)>3) {
        window.external.AddFavorite( location.href, document.title );
    }
    return void(0);
}

function setStartPage(e) {
    if (navigator.appName=="Netscape") {
        alert( 'Katt az "Eszközök -> Beállítésok" és ott "Kezdőlap -> Aktuális oldal használata".' );
    } else if (parseInt(navigator.appVersion)>3) {
        e.style.behavior='url(#default#homepage)'; e.setHomePage( window.location.href );
    }
}
function SelectDate(n) {
	hivas.mezo=n;
	w=window.open('inc/calendar/calendar.php?Datum='+n.value,'naptar','height=300,width=230,screenX=20,screenY=57,resizable=no,status=no,scrollbars=no,menubar=no,titlebar=no');
	w.focus();
}
function openWindow(theURL,winName,features) {
	if(!winName)
	    winName='_blank';
	if(!features)
		features = 'width=520, height=700, menubar=no, toolbar=no, location=no, status=no, scrollbars=yes, resizable=yes';
	window.open(theURL,winName,features);
}
function vi(id) {
    var o=document.getElementById(id);
	o.style.visibility='visible';
	o.style.display='block';
}
function hi(id) {
    var o=document.getElementById(id);
	o.style.visibility='hidden';
	o.style.display='none';
}
function elrejt(mit) {
    var mit=document.getElementById(mit);
	mit.style.display=(mit.style.display=="block")? "none" : "block";
}
function biztose(url, kerdes) {
	if (!kerdes)
		kerdes = "Biztos, hogy törölni akarja?";
    if (confirm(kerdes)) 
		location.href = url;
	return false;
}

function setCheckboxes(the_form, do_check) {
	var elts = document.forms[the_form].elements['foto_ids[]'];
	var elts_cnt  = (typeof(elts.length) != 'undefined') ? elts.length : 0;
    if (elts_cnt) {
        for (var i = 0; i < elts_cnt; i++) {
            elts[i].checked = do_check;
        }
    } else {
        elts.checked        = do_check;
    }
    return true;
}

function checkEmail(myForm) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.value)) {
		return (true)
	}
	alert("Érvénytelen e-mail cím!\n     Írd be újra.")
	return (false)
}
function printwindow() {
	bV = parseInt(navigator.appVersion)
	if (bV >= 4) { 
		window.print(); window.opener=self;
	}
}
function init(){
	var width = 180;
	var height = 180;
	self.resizeTo(width, height);
	self.moveTo((screen.width-width)/2, (screen.height-height)/2);
	self.focus();
}
function jumpMenu(selObj){
  eval("parent.location='"+selObj.options[selObj.selectedIndex].value+"'");
}
function valueUpdate( val, InputId ) {
    if( val )
        document.getElementById(InputId).value = val;
}
