var aivao_mobile = false;
//alert($.os['name']);
if($.os['name'] == 'ipod' || $.os['name'] == 'ipad' || $.os['name'] == 'iphone') { 
	aivao_mobile = true;
}

function aivao_catch_a(){
	
	$("a").click(function(e){
		if($.trim($(this).attr("href")) == "#"){
		 	e.preventDefault();
		}
	});
}




function aivao_alertinfo(options){
	if (options['duration'] === undefined) {
		options['duration'] = 2000;
	}
	$.prompt(options['html'],{
		opacity: 0.8,
		top:'33%',
		persistent:true,
		timeout:options['duration'],
		prefix:'ldng'
	});
}


function aivao_alert_close(options){
	$.prompt.close();
}

function aivao_alert(options){
	
	$.prompt(options['html'],{
		opacity: 0.8,
		top:'20%',
		persistent:true
	});
}
function aivao_alert_close(options){
	$.prompt.close();
}

var aivao_isloading = false;
function aivao_loading(options){
	if(!aivao_isloading){
		aivao_isloading = true;
		$.prompt('<img src="/cms/front/pix/loading.gif" />',{
			opacity: 0.8,
			top:'44%',
			persistent:false,
			prefix:'ldng'
		});
	}
}
function aivao_loading_close(options){
	$.prompt.close();
	aivao_isloading = false;
}


function aivao_logout(options) {
	$.post('/cms/front/ajax/logout.php', {}, function(data) {
		window.location.reload(true);
	}, 'json');
}


$(function() {	
	 

	aivao_catch_a();
	
	$(".top").click(function(e){
		 $('html, body').animate({scrollTop:0}, 'slow');
	});
	
	$('form').keyup(function(e) {
		//alert(e.keyCode);
		if(e.keyCode == 13) {
			e.preventDefault();
		}
	});
	
	$('.info').find('form').submit(function(e) {
		//alert(1);
		e.preventDefault();
		
	});
	
	$('#navi > .pad > ul > li').hoverIntent({
		over: function () {
			if(!$(this).hasClass('on')){
				$(this).find('ul').fadeIn(300);
				$('#navi li.on').find('ul').fadeOut(300);
			}
		},
		timeout:700,
		out: function () {
			if(!$(this).hasClass('on')){
				$(this).find('ul').fadeOut(600);
				$('#navi li.on').find('ul').fadeIn(600);
			}
		}
		
	});
	
	
	
	if(!aivao_mobile){
		$('.container').focus(function() {
		  $(this).blur();
		});
		aivao_catch_a({});
	}

	
	
	
	
	
	
	
});



