
if ( typeof( $ ) != 'undefined' ){
	$.noConflict();
}
/*-------------- init --------------*/
var callback=0;
var item_pad=0;
var menu_width=0;
var menu_height=0;
var menu_padding=18;
var fontsize = 12;

/*
function sw_on_page_resize(){
	var bodywidth = jQuery(document).find("html").width();
	var body_obj = jQuery("body");
	if ( bodywidth <=255) {
		body_obj.addClass("mobile_240").removeClass("mobile_350 mobile_460");
	}  else if(bodywidth < 360) {
		body_obj.addClass("mobile_350").removeClass("mobile_240 mobile_460");
	} else {
		body_obj.addClass("mobile_460").removeClass("mobile_240 mobile_350");
	}
	
	
	//alert(bodywidth);
	if ( typeof(console) != 'undefined' ) {
		console.log( bodywidth );
		console.log( body_obj.attr('class') );
	}
}
*/

jQuery(document).ready(function(){
	
	
	var box_menu = jQuery("#side_content .menu a");
	var box_links = jQuery("#side_content #sw_62_article_text a");
	if(box_links.length==0){
		box_links = jQuery("#side_content #sw_64_article_text a");
	}
	if(box_links.length==0){
		 box_links = jQuery("#side_content #sw_84_article_text a");
	}
	
	if ( typeof(sw_debug) == 'undefined' ){
		sw_debug = false;
	}
	
	if ( !sw_debug && jQuery.browser.mobile==false && (box_menu.length || box_links.length)) {

		box_links.addClass('item_inact');
		box_menu.addClass('item_inact');
		

		jQuery(".item_inact").hover(function(){
			menu_width = (jQuery(this).parent().width()-menu_padding);
			//console.log(menu_width);
			item_pad = menu_width-(jQuery(this).width())+5;
			jQuery(this).removeClass('item_inact');			
			jQuery(this).css({'margin-right':'-4px'});
			jQuery(this).animate({'padding-right':item_pad+'px'},{queue:false,duration:500});
					
		}, function(){
			jQuery(this).animate({'padding-right':'5px'},500,
						function(){					
							jQuery(this).css({'margin-right':'0'});
							jQuery(this).removeClass('item_act');
							jQuery(this).addClass('item_inact');
						});
		});
		jQuery("#side_content li a").click(function(){
			jQuery("#side_content li a").removeClass('sw_s1_mi_selected');
			jQuery(this).addClass('sw_s1_mi_selected');
		});
		
		
	}
	else if( sw_debug || (jQuery.browser.mobile==true && (box_menu.length || box_links.length) ) ){

		jQuery("#side_content").css({"position":"absolute","height":"26px"}); 
		
		//alert(  bodywidth = jQuery(document).find("html").width() );
		
		/*
		setTimeout( 'sw_on_page_resize()', 500 );
		
		jQuery(window).resize(function() {
			sw_on_page_resize();
		});
		*/
		

		jQuery("#side_content .article_text").before("<a href='javascript:void(0);' id='more_menu' title='menü legördítéséhez kattintson ide'>&nbsp;</a>");
		//alert(jQuery("#side_content .article_text").html());
		menu_height = (jQuery("#side_content .menu").outerHeight())+(jQuery("#side_content .article_text").outerHeight()+50);
		
		jQuery("#side_content #more_menu").click(function(){
			
			if(callback==0){
			jQuery("#main_content").animate({'margin-top':menu_height+'px'},500);
			jQuery("#side_content").animate({'min-height':menu_height+'px'},500,
						function(){					
							callback = 1;
						});
			}	
			else{
			jQuery("#main_content").animate({'margin-top':'26px'},500);
			jQuery("#side_content").animate({'height':'26px'},500,
						function(){					
							callback = 0;
						});
			}
		});
	
	}
		
	
});

