//document load
$j(function(){
	

	$j('[class^="highslideparent"]').click(function(event){
		event.preventDefault();
		var width2 = 600;
		var height2 = 300;
		var class2 = $j(this).attr('class');
		var class_arr2 = class2.split("_");
		
		if(class_arr2.length>2){
			width2 = parseInt(class_arr2[1]);
			height2 = parseInt(class_arr2[2]);
		}
		
		var a_title = $j(this).attr("title").replace(" ","_");
		a_title = a_title.replace(",","_");
		
		call_analytics("online_megrendeles_hs_"+a_title.toLowerCase(),1);
		
		window.parent.open_highslide(this,width2,height2);
	});
	
	$j('[class^="highslidesimple"]').click(function(event){
		event.preventDefault();
		var width2 = 600;
		var height2 = 300;
		var class2 = $j(this).attr('class');
		var class_arr2 = class2.split("_");
		
		if(class_arr2.length>2){
			width2 = parseInt(class_arr2[1]);
			height2 = parseInt(class_arr2[2]);
		}
		
		
		
		//hs_close();
		open_highslide(this,width2,height2);
		
		//return hs.close(this);
	});
	
	
	//bejelentkezés donoz
	$j("#login_down").toggle(function(){
		$j("#login_container").animate({"top": "0px"}, "slow",function(){
				//$j("#login_down").css({"background-color":"#fff"});
				$j("#login_down").css({"background":"url('/img/body_center/body_center_bg.png') repeat-y scroll right top #000"});
				
			}
		);
		
	},function(){
		$j("#login_container").animate({"top": "-135px"}, "slow",function(){
				//$j("#login_down").css({"background-color":"#000"});
				$j("#login_down").css({"background":"none"});
			}
		);
		
	});
	
	//if($j("#admin_vagyok").length){
		if(cookie_get("alert_box")==null){
			$j.delay(15, function(){
				//Do anything after 5 second
				//alert("5 sec");
				$j("#ugyfelszolgalat_a").trigger('click');
				
			});
		
			cookie_set("alert_box","1",1);
		}
	
		
	//}
	
});


function hs_close(){
	hs.close();
}


function altaker_analytics(conversion){
	window._gaq.push(['_trackPageview', '/altanet/'+conversion+'.html']);
}

function call_analytics(page,is_parent){
	if(is_parent){
		window.parent._gaq.push(['_trackPageview', '/altanet/'+page+'.html']);
	}
	else{
		window._gaq.push(['_trackPageview', '/altanet/'+page+'.html']);
	}
}


function open_highslide(obj,width_,height_){
	return hs.htmlExpand(obj,{objectType:'iframe',width:width_, height:height_, headingEval: 'this.a.title', align:'auto', captionOverlay:{ position: 'rightpanel', width: '1px'} });
}

function altanet_execute_processes(process_ids){
	if(process_ids!=''){
		$j.post("ajax.php?act=execute_processes", { process_ids: process_ids} ,function(data){
     		alert(data);
   		});
	}
}

function gotoUrl(u) { 
	window.parent.location.href = u; 
}
