function init() {
        if (!document.getElementById) return
        var imgOriginSrc
        var imgTemp = new Array()
        var imgarr = document.getElementsByTagName('img')
        for (var i = 0; i < imgarr.length; i++) {
                if (imgarr[i].getAttribute('hsrc')) {
                                imgTemp[i] = new Image()
                                imgTemp[i].src = imgarr[i].getAttribute('hsrc')
                                imgarr[i].onmouseover = function() {
                                        imgOriginSrc = this.getAttribute('src')
                                        this.setAttribute('src',this.getAttribute('hsrc'))
                                }
                                imgarr[i].onmouseout = function() {this.setAttribute('src',imgOriginSrc)}
                }
        }
		}
//		onload=init;

	function s(a){
		$('#submenu'+a).show();
		}
	function h(a){
//		window.alert('AH!');
		$('#submenu'+a).hide();
		}

	function get_xposition_by_id(Id) {
		var elem_absoulte_position = $("#" + Id).offset();
		return (elem_absoulte_position.left);
	}

	function get_yposition_by_id(Id) {
		var elem_absoulte_position = $("#" + Id).offset();
		return (elem_absoulte_position.top);
	}

	$(window).load(function() {
			pos();
		});

	$(window).resize(function() {
			pos();
		});

	function pos(){
		/*$('#submenu1').hide();
		$('#submenu2').hide();*/
		h(1);
		h(2);
		
		$('#submenu1').animate({
			'marginTop' : get_yposition_by_id('g_autotEladna')+1,
			'marginLeft' : get_xposition_by_id('g_autotEladna')-7
		});
		
		$('#submenu2').animate({
			'marginTop' : get_yposition_by_id('g_autotVenne')+1,
			'marginLeft' : get_xposition_by_id('g_autotVenne')-6
		});
		
		}

function addExtra(a){
    fo = document.autoForm;
    fo.autoExtra.value+=a;
}

function removeExtra(a){
fo = document.autoForm;
if (fo.autoExtra.value.indexOf(a)!=-1){
    astart = fo.autoExtra.value.indexOf(a);
    aend   = fo.autoExtra.value.indexOf(a)+a.length;
    send   = fo.autoExtra.value.length;
    temp=fo.autoExtra.value.substring(0,astart)+fo.autoExtra.value.substring(aend,send)
    fo.autoExtra.value=temp;
}else{
    window.alert('Az adott felszereltség ebben a formában nem szerepel!');
}
}

function resizepic(a){
//      x=window.open('/pic.jsp?pic='+a,"autolicit","width=800,height=600,resizable=0,status=0,scrollbars=0,left=" + ((screen.width/2)-400) + ",top=" + ((screen.height/2)-300));
        x=window.open('/picresize.jsp?pic='+a,"galeria","width=850,height=600,resizable=0,status=0,scrollbars=0,left=" + ((screen.width/2)-400) + ",top=" + ((screen.height/2)-265));
        x.focus();
        }

function printwin(autoId){
    y=window.open('/showautoPdf.do?autoId='+autoId+'&print=true&pdf=true',"autolicit","width=800,height=600,resizable=0,status=0,scrollbars=1,left=" + ((screen.width/2)-350) + ",top=" + ((screen.height/2)-300));
    //y=window.open('/showauto.do?autoId='+autoId+'&print=true',"autolicit","width=800,height=600,resizable=0,status=0,scrollbars=1,left=" + ((screen.width/2)-350) + ",top=" + ((screen.height/2)-300));
y.focus();
}

function molwin(autoId){
    y=window.open('/allapotlap.do?autoId='+autoId+'&print=true&pdf=true',"autolicit","width=800,height=600,resizable=0,status=0,scrollbars=1,left=" + ((screen.width/2)-350) + ",top=" + ((screen.height/2)-300));
    //y=window.open('/showauto.do?autoId='+autoId+'&print=true',"autolicit","width=800,height=600,resizable=0,status=0,scrollbars=1,left=" + ((screen.width/2)-350) + ",top=" + ((screen.height/2)-300));
y.focus();
}

function printwin2(autoId){
    y=window.open('/setauto.do?autoId='+autoId+'&print=true',"autolicit","width=800,height=600,resizable=0,status=0,scrollbars=1,left=" + ((screen.width/2)-400) + ",top=" + ((screen.height/2)-300));
y.focus();
}

function printwin3(autoList){
    y=window.open(autoList+'&print=true',"autolicit","width=800,height=600,resizable=0,status=0,scrollbars=1,left=" + ((screen.width/2)-400) + ",top=" + ((screen.height/2)-300));
y.focus();
}

function xlswin(url){
    document.location.href=url;
}

function popitup(url) {
    url="http://szavazo.net/showpoll.php?id=71139&type=link";
    newwindow=window.open(url,'name','height=400,width=600'); 
    if (window.focus) {newwindow.focus()}
    return false;
    }

function picdel(a){
    if (self.confirm("Biztosan törölni akarja a képeket?")){
    document.location.href="/deletepics.do?autoId="+a;
}
}

function docdel(a){
    if (self.confirm("Biztosan törölni akarja a dokumentumokat?")){
    document.location.href="/deletedocs.do?autoId="+a;
}
}

function popup(a){
    y=window.open(a,"autolicit","width=500,height=100,resizable=0,status=0,scrollbars=1,left=" + ((screen.width/2)-250) + ",top=" + ((screen.height/2)-50));
    y.focus();
}

function thumbnail(a){
    al_tmb=window.open('/thumbnail.php?pic/'+a+'_1.jpg',"thumbnail", "width=100,height=80,resizable=0,status=0,scrollbars=0, left=" + ((screen.width/2)-200) + ",top=" + ((screen.height/2)-100))
    al_tmb.focus();
}

