$(document).ready(function(){
	slidesFlag = $("#slides");
	if(slidesFlag.length > 0){
		$('#slides').cycle({ 
			fx:      'fade', 
			speed:    1000, 
			timeout:  7000, 
			pager: '#slides-nav .nav', 
			pause: 1,
			pagerAnchorBuilder: function(idx, slide) {return '<a href="#"></a>';} 
		});	
	}

	$("#pikame").PikaChoose({
		auto_play:true, 
		show_captions:false,
		show_prev_next: false,
		thumb_width: 56,
		thumb_height: 38		
	});
				
	$("#mainMenu li.category, #mainMenu li.firstcategory").mouseover(function(){		
		$("#sub" + this.id).show(0);
		$("#subr" + this.id).css("margin-left", "9px");
		$("#subr" + this.id).show(0);		
	});     
	$("#mainMenu li.category, #mainMenu li.firstcategory").mouseleave(function(){		
		$("#sub" + this.id).hide(0);	
		$("#subr" + this.id).hide(0);				
	});
	
	$('#mphone').keydown(function(event){
		if(
			((!event.shiftKey)&&(event.which > 47) && (event.which < 58))||
			((event.which > 95) && (event.which < 106))
			||(event.which == 9)
			||(event.which == 37)
			||(event.which == 39)
		){
			if ($(this).val().length==0)
				$(this).val('('+$(this).val());
			if ($(this).val().length==4)
				$(this).val($(this).val()+')');
			if ($(this).val().length==8)
				$(this).val($(this).val()+'-');
			return;
		}
		else{
			if ((event.which == 8)||(event.which == 46)){
				$(this).val('');
				return;
			}else
				return false;
		}
	});
}); 
