//OnLoad
//window.onload = onLoadinit;

//ReSize
//window.onresize = onResizeinit;

$(document).ready(function(){
		
		addZoomIcon();
		loadurl('index.php?m=16897&content=1','banner');
		setupZoom();
		selectSearchType();
});

/*function onLoadinit() {
	loadurl('index.php?m=16897&content=1','banner');
	setupZoom();
	selectSearchType('product');
	addZoomIcon();
}
function onResizeinit(){
	
}*/


function selectSearchType() {
	
	/*var form = document.forms['searchform'];
	
	for( i = 0; i < form.searchtype.length; i++ )
		{
			if( form.searchtype[i].checked == true )
			type = form.searchtype[i].value;
		}*/
		
	/*var keresoinput = document.getElementById("keresoinput");
	
	if (type == "product") {
		document.searchform.action = '/index.php?m=16903';
		keresoinput.innerHTML='<input type="text" name="fXid" class="input" value="cikkszám (min. 4 betű)" onblur="if(this.value==\'\') this.value=\'cikkszám (min. 4 betű)\';" onfocus="this.value=\'\';">';
	} else if (type == "page") {
		document.searchform.action = '/index.php?m=search';
		keresoinput.innerHTML='<input type="text" name="INC_string" class="input" value="kulcsszó" onblur="if(this.value==\'\') this.value=\'kulcsszó\';" onfocus="this.value=\'\';"/>';
	}*/
	
	
	/*jQuery*/
	
	$("input#search_product").attr("checked","checked");
	$("form#search").attr("action",'/index.php?m=16903');
	$("#keresoinput input").attr("name",'fXid');
	$("#keresoinput input").attr("title",'Cikkszám (min. 4 karakter)');
	
	$("input#search_product").click(function(){
		$("form#search").attr("action",'/index.php?m=16903');
		$("#keresoinput input").attr("name",'fXid');
		$("#keresoinput input").attr("title",'Cikkszám (min. 4 karakter)');
	});

	$("input#search_page").click(function(){
		$("form#search").attr("action",'/index.php?m=search');
		$("#keresoinput input").attr("name",'INC_string');
		$("#keresoinput input").attr("title",'Írjon be egy kulcsszót...');
	});
	
	
	
	
}
function addZoomIcon(){
	$("#content_content a[href*=kep.php]:has(img)").prepend('<span class="zoomicon"></span>');
		
    $("#content_content a[href*=kep.php]:has(img)").hover(function(){
																					 
				titleText = $(this).attr("title");
				//alert(titleText);
				altText = $(this).children("img").attr("alt");
				$(this).removeAttr("title");
				$(this).children("img").removeAttr("alt");
				$(this).children("span.zoomicon").css({left: $("img", this).position().left+$("img", this).width()-16,top: $("img", this).position().top+$("img", this).height()-16});
				
				
        $(this).children("span.zoomicon").show();

    },function(){
        $(this).children("span.zoomicon").hide();
				$(this).attr("title",titleText);
				$(this).children("img").attr("alt",altText);
    });
		$("#content_content a[href*=kep.php]:has(img)").click(function(){
			$(this).children("span.zoomicon").hide();
			if(titleText!='')
			$(this).attr("title",titleText);
			else
			$(this).attr("title",altText);
		});
}