function seturls(kepsrc)
{
	document.images.elonezet.src='/mediatar/tn_'+kepsrc;
	document.mediatar.kiskep.value='/mediatar/tn_'+kepsrc;
	document.mediatar.nagykep.value='/mediatar/'+kepsrc;
}

function gktab()
{
	$('#fk').hide();
	$('#ns_container').show('slow');
	$('#gumikereso').attr('src', '/images/gumikereso.png');
	$('#felnikereso').attr('src', '/images/felnikereso_off.png');
}

function fktab()
{
	$('#ns_container').hide();
	$('#fk').show('slow');
	$('#gumikereso').attr('src', '/images/gumikereso_off.png');
	$('#felnikereso').attr('src', '/images/felnikereso.png');
}

function filterOptions(w,h,d,url)
{
	$.get((url?url:'/ajax/sizes'),{w:w,h:h,d:d},function(data){$('#search-box').html(data);});
}

function filterSelect(w,h,d)
{
	if (w && !h)
	{
		$('#sh').html('<option>Frissítés</option>');
		$('#sd').html('<option>Frissítés</option>');
		$.get('/ajax/verticalsearch',{element:'h', w:w, d:d},function(data){$('#sh').html(data);});
		$.get('/ajax/verticalsearch',{element:'d', w:w, d:d},function(data){$('#sd').html(data);});
	}
	if (w && h)
	{
		$('#sd').html('<option>Frissítés</option>');
		$.get('/ajax/verticalsearch',{element:'d', w:w, h:h, d:d},function(data){$('#sd').html(data);});
	}
}

function disableIdeny(cbObj)
{
	if (cbObj.checked)
	{
		$('#it').attr('disabled',true);
		$('#in').attr('disabled',true);
	}
	else
	{
		$('#it').attr('disabled',false);
		$('#in').attr('disabled',false);
	}
}

function copyData(cbObj)
{
	$('#tname').val($('#oname').val());
	$('#taddress').val($('#oaddress').val());
}


function szamologep(rId)
{
	$('#szg'+rId).html('Bruttó: '+Math.round($('#v'+rId).val()*1.25*(1-($('#k'+rId).val()/100)))+' Ft,-');
}


function checkWidth()
{
	if ($('#wSelect :selected').val() <= 100)
		document.getElementById('hSelect').selectedIndex = 0;
}

function checkWidth2()
{
	if ($('#sw :selected').val() <= 100)
		document.getElementById('sh').selectedIndex = 1;
}

function megrendel(productId, db)
{
	$.get('/kosar/megrendel',{id: productId, darab: db},function(data){$('#kosar').html(data);alert('Termék a kosárba téve');});
}

function torol(kosarKey, reload)
{
	$.get('/kosar/torol',{id: kosarKey},function(data){$('#kosar').html(data);});
	if(reload) 
	{
		window.location.reload();
	}
}

function novel(kosarKey, reload)
{
	$.get('/kosar/novel',{id: kosarKey},function(data){$('#kosar').html(data);});
	if(reload) 
	{
		window.location.reload();
	}
}

function allit(kosarKey, mennyiseg, reload)
{
	$.get('/kosar/allit',{id: kosarKey, db: mennyiseg},function(data){
		$('#kosar').html(data);
		if(reload) 
		{
			window.location.reload();
		}
		});
	
}


function confirmAction(jumpURL,alertTitle)
{
	var alertVar = confirm(alertTitle);
	if (alertVar == true)
	{
		window.location.href = jumpURL;
	}
}


function getLayerHeight(block)
{
	if(block.offsetHeight != undefined)
		return block.offsetHeight;
	if(block.height != undefined)
		return block.height;
	if(block.pixelHeight != undefined)
		return block.pixelHeight;
	return null;
}

function browserSize()
{
	var myWidth = 0, myHeight = 0;
	if(typeof(window.innerWidth) == 'number') {
	    //Non-IE
		myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
		}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	  	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	  	}
	return myHeight;
	}
