function deltimer(type)
{
	document.getElementById(type).value = "";
}
function eurhuf_bodyonload()
{
	var allinputs=document.getElementsByTagName("input");
	for(var i=0;i<allinputs.length;i++)
	{
		if (allinputs[i].type=="text")
		{
			if (allinputs[i].name.toLowerCase().match("_eur")!==null || allinputs[i].name.toLowerCase().match("_huf")!==null)
			{
				allinputs[i].onchange=function(){arinput_onchange(this);};
			}
		}
	}
}
function arinput_onchange(dis)
{
		dis.value=dis.value.replace(/,/,'.');
		dis.value=dis.value.replace(/[^0-9.]/,'');
		if (dis.name.toLowerCase().match("_eur"))
		{			
			dis.value=parseFloat(dis.value).toFixed(2).toString();
		}
		else
		{
			dis.value=parseInt(dis.value);
		}
		if (dis.value=="NaN")
		{
			dis.value="";
		}
}

function parseResult(input) {
	var select_id  = '__srcList'; // Ebben cserel majd tartalmat
	var selectELMT = document.getElementById(select_id);

	// Mostani lista torlese //
	var select_length = selectELMT.length;
	for (var i = 0; i < select_length; i++) {
		selectELMT.remove(0);
	}

	// Uj adatok betoltese //
	if (input != '') {
		eval(input);
		for (var i = 0; i < users.length; i++) {
            var newOptionELMT   = document.createElement('option');
            newOptionELMT.text  = users[i][1];
            newOptionELMT.value = users[i][0];
			try { // standards compliant; doesn't work in IE
				selectELMT.add(newOptionELMT, null);
			}
			catch(ex) { // IE only
				selectELMT.add(newOptionELMT);
			}
		}
	}
}

function searchSelectBox(in_sFormName, in_sInputName, in_sSelectName)
{
	sSearchString = document.forms[in_sFormName].elements[in_sInputName].value.toUpperCase();
	iSearchTextLength = sSearchString.length;
	for (j=0; j < document.forms[in_sFormName].elements[in_sSelectName].options.length; j++)
	{
		sOptionText = document.forms[in_sFormName].elements[in_sSelectName].options[j].text;
		sOptionComp = sOptionText.substr(0, iSearchTextLength).toUpperCase();
		if(sSearchString == sOptionComp) {
			document.forms[in_sFormName].elements[in_sSelectName].selectedIndex = j;
			break;
		}
	}
}

function SelectAll()
{
    elements = new Array();
    elements[0] = "att_contents";
    elements[1] = "att_news";

	for(var j = 0; j < elements.length; j++)
	{
        var s = document.getElementById(elements[j]);
        for(var i = 0; i < s.options.length; i++)
        {
            s.options[i].selected = true;
        }
	}
	return true;
}

var checkflag = "false";
function doNow()
{
	d  = document;
	el = d.getElementsByTagName('INPUT');

	if (checkflag == "false") {
		for(i = 0; i < el.length; i++)
		{
			if (el[i].disabled == 0) el[i].checked = 1;
		}
		checkflag = "true";
	} else {
		for(i = 0; i < el.length; i++)
		{
			el[i].checked = 0;
		}
		checkflag = "false";
	}
}

function strt()
    {

    var i;
    var fm = 0;
    /*
    for(i=1;i<9;i++) {
    var mt = document.getElementById('menutext'+i).offsetWidth;
    mc = mt + 10;
    mb = mt + 15;
    fm = fm + mt;
    document.getElementById('menucolor'+i).style.width=mc + 'px';
    }
    */

    if(myPix.length>0){
    t = setTimeout('doNext()',2000);
    f = setTimeout("currentOpac('myPicture', 50, 500)",1700);
    document.getElementById('highpic0').style.color='#FF0000';
    }

    //pngfix();
}

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}


function doPrevious() {
    if (document.images && thisPic == 0) {
       thisPic = (myPix.length)-1;
       document.myPicture.src=myPix[thisPic];
       document.getElementById('myHref').href =picHref[thisPic];
    }
    else if (document.images && thisPic > 0) {
        thisPic = thisPic-1;
        document.myPicture.src=myPix[thisPic];
        document.getElementById('myHref').href =picHref[thisPic];
    }

    for(i=0;i<myPix.length;i++) {
        document.getElementById('highpic'+i).style.color='#777676';
    }
    document.getElementById('highpic'+thisPic).style.color='#FF0000';
    currentOpac('myPicture', 100, 300);
    clearTimeout(f);
    f= setTimeout("currentOpac('myPicture', 50, 500)",1700);    
    clearTimeout(t);
    t= setTimeout('doPrevious()',2000);
}

function doNext() {
    
    //opacity('myPicture', 0, 100, 1000);
    //blendimage('myPicture','myPicture', myPix[thisPic], 500);
    
    if (document.images && thisPic == ((myPix.length)-1)) {
       thisPic = 0;
       
       document.myPicture.src=myPix[thisPic];
       //currentOpac('myPicture', 0, 300);
       document.getElementById('myHref').href =picHref[thisPic];
    }

    else if (document.images && thisPic < myPix.length-1) {
        thisPic++;
        document.myPicture.src=myPix[thisPic];
        
         document.getElementById('myHref').href =picHref[thisPic];
    }

    for(i=0;i<myPix.length;i++) {
        document.getElementById('highpic'+i).style.color='#777676';
    }
    document.getElementById('highpic'+thisPic).style.color='#FF0000';
    currentOpac('myPicture', 100, 300);
    clearTimeout(f);
    f= setTimeout("currentOpac('myPicture', 50, 500)",1700);
    clearTimeout(t);
    t= setTimeout('doNext()',2000);
}

function doPic(PicNum) {
        document.myPicture.src=myPix[PicNum];
        currentOpac('myPicture', 100, 0);
        document.getElementById('myHref').href =picHref[PicNum];
        thisPic = PicNum;
        for(i=0;i<myPix.length;i++) {
            document.getElementById('highpic'+i).style.color='#777676';
        }
        document.getElementById('highpic'+thisPic).style.color='#FF0000';
        clearTimeout(t);
        t= setTimeout('doNext()',10000);
      
}

function newCall() {
	window.open("callback.php","callback", "width=401,height=305,menubar=no,status=no,scrollbars=no,toolbar=no");
}

function email(id) {
	window.open("email.php?pid="+id,"callback", "width=401,height=375,menubar=no,status=no,scrollbars=no,toolbar=no");
}



