
isNC	= (document.layers) ? 1 : 0;
isOPERA = (navigator.userAgent.indexOf('Opera') >= 0)? true : false;
isIE	= (document.all && !isOPERA)? true : false;
isDOM	= (document.getElementById && !isIE && !isOPERA)? true : false;

ordered = new Array(); // megrendelt elemek
refreshOpener = 0;

function mcTopMenuOver( obj, id ){document.getElementById(id).style.background = '#758198';}
function mcTopMenuOut( obj, id ){
	if( id != 'menu_'+page )
	document.getElementById(id).style.background = null;
}
function setAValue(id, id2, moveFocusToId){
	document.getElementById(id).value = document.getElementById(id2).value
	if(moveFocusToId) document.getElementById(id).focus();
	return false;
}
function addAValue(id, id2, moveFocusToId, delimer){
	addDelimer = ( document.getElementById(id).value.length < 1 ) ? '' : delimer;
	document.getElementById(id).value = document.getElementById(id).value+''+addDelimer+''+document.getElementById(id2).value
	if(moveFocusToId) document.getElementById(id).focus();
	return false;
}
function confirmImgDelet(theURL,winName,features, id) { //v2.0
	if(confirm("Biztosan törlöd a képet? [id: "+id+"]")) MM_openBrWindow(theURL,winName,features);
	return false;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
  return false;
}
function openOneFotoImageWindow(what, id){
	MM_openBrWindow('galeria.php?imageWindow=2&what='+what+'&id='+id+'','imageWindow','status=yes,width=580,height=550,top=20,left=20');
	return false;
}
function openKiadvanyImageWindow(page, id, imgIndex){
	MM_openBrWindow(page+'.php?imageWindow=1&id='+id+'&what=kiadvany&imgIndex='+imgIndex,'imageWindow','status=yes,width=580,height=550,top=20,left=20');
	return false;
}
function openFotoarchivImageWindow(page, id, group, imgIndex){
	MM_openBrWindow(page+'.php?imageWindow=1&group='+group+'&what=foto&imgIndex='+imgIndex,'imageWindow','status=yes,width=580,height=550,top=20,left=20');
	return false;
}
function openFotoSearchImageWindow(action, word, keyword, group, srcPage, what, imgIndex){
	MM_openBrWindow(page+'.php?imageWindow=1&action='+action+'&word='+word+'&keyword='+keyword+'&group='+group+'&page='+srcPage+'&what='+what+'&imgIndex='+imgIndex,'imageWindow','status=yes,width=580,height=550,top=20,left=20');
	return false;
}
function openPartnerImageWindow(page, dir, imgIndex){
	MM_openBrWindow(page+'.php?imageWindow=1&page='+page+'&dir='+dir+'&imgIndex='+imgIndex,'imageWindow','status=yes,width=580,height=550,top=20,left=20');
	return false;
}
function orderChecker(what, id)
{
	var aPSrcArray = document.getElementById(''+id).src.split('/');
	var aPSrc = aPSrcArray[aPSrcArray.length-1];
	if( aPSrc == 'p2.gif' )
	{
		var action = 'remove';
		document.getElementById(''+id).src = 'images/p1.gif';
		if(document.getElementById('orderBySizeImgWin'))
		document.getElementById('orderBySizeImgWin').style.height = 1;
	}
	if( aPSrc == 'p1.gif' )
	{
		var action = 'add'; 
		document.getElementById(''+id).src = 'images/p2.gif';
		if(document.getElementById('orderBySizeImgWin'))
		document.getElementById('orderBySizeImgWin').style.height = 100;
		if( document.getElementById('imageDbInput['+id+'][1]') ){
			var count = 1;
			while(document.getElementById('imageDbInputKeys['+id+']['+count+']')) count++;
			var db = '';
			for (var i = 1; i < count; i++) {
				//if(document.form1.imageDbInput['+id+'][i].checked)
				var key = document.getElementById('imageDbInputKeys['+id+']['+i+']').value; //document.form1.imageDbInputKeys['+id+'][i].value;
				var val = document.getElementById('imageDbInput['+id+']['+i+']').value; //document.form1.imageDbInput['+id+'][i].value;
				if( val )
				db += "/size["+key+"]="+val;
			}
			if( document.getElementById('imageDbInput['+id+'][egyeb]') && document.getElementById('imageDbInput['+id+'][egyeb]').value )
			db += "/size[egyeb]="+document.getElementById('imageDbInput['+id+'][egyeb]').value;
		}
	}
	db = (!db) ? 1 : db;
	// alert(db)
	var orderSrc = 'ordered.php?action='+action+'&what='+what+'&id='+id+'&db='+db+'';
	document.getElementById("ordered").src = orderSrc;
	refreshOpener = 1
	return false;
}
function partnerImgSelect(img)
{
	var aPSrcArray = document.getElementById(''+img).src.split('/');
	var aPSrc = aPSrcArray[aPSrcArray.length-1];
	if( aPSrc == 'p2.gif' )
	{
		var action = 'remove'; 
		document.getElementById(''+img).src = 'images/p1.gif';
	}
	if( aPSrc == 'p1.gif' )
	{
		var action = 'add'; 
		document.getElementById(''+img).src = 'images/p2.gif';
	}
	var selSrc = 'partnerSelectedImg.php?action='+action+'&img='+img+'';
	document.getElementById("partnerSelectedImg").src = selSrc;
	return false;
}
function myUnload()
{
	if(refreshOpener) opener.location.reload();
}

function myOnResize()
{
	//alert(document.getElementById("menuLayer").style.left);
	docContentW = 775;
	if(isIE || isOPERA) { DW = (document.body.clientWidth-docContentW)/2; }
	if(isNC || isDOM){ DW = (innerWidth-docContentW)/2; }
	if( DW > 0 ) document.getElementById("menuLayer").style.left = DW
}
function init()
{
	window.onresize = myOnResize;
	// myOnResize()
}

function setH(id0, id, h1, h2){
	elem = document.getElementById(id);
	elem.style.height = h1;
	document.getElementById(id0).onmouseout = function() { elem.style.height = h2; };
}

function setStyle(id, prop, val)
{
	document.getElementById(id).style[''+prop] = val;
}
function setStatus(text)
{
	window.status = text;
}

