$(function(){
	
	/*IE 6*/
	if($.browser.msie){
		if($.browser.version == '6.0'){ alert('Please Download IE 7 browser or later')};
	}
	
	/*Autosuggest Close*/
	$('*:not(#result_main)').click(function(){
    	$('#result_main').css('visibility','hidden');
	});
	
	/*Shocase and description in Profile page*/
	$("#BusDes1").click(function(){ $("#BusDes2").slideToggle(250); return false; } );
    $("#Show_case1").click(function(){ $("#Show_case2").slideToggle(300); return false; } );
    $("#togglebar").click(function(){ $("#togglepopup").slideToggle(300); $(this).toggleClass('rel_keys2_down'); return false; });
	
	/*All Input Button*/	
	$('input[type="submit"], input[type="button"]:not(.search), input[type="reset"], button').addClass('input_btn');
	
	/*All Input Text Focus*/	
	$('select, textarea, input[type="text"], input[type="password"]').addClass('input_txt');
	
	$('select, textarea, input[type="text"], input[type="password"]').focus(function(){				
		$(this).addClass('focus_txt');
	});	
	$('select, textarea, input[type="text"], input[type="password"]').blur(function(){
		$(this).removeClass('focus_txt');
	});
	
	$('#txtCategorymaster, #txtCitymaster').focus(function(){
		if(this.value == this.defaultValue){ this.value = '';}
		if(this.value != this.defaultValue){ this.select();}
	});
	$('#txtCategorymaster, #txtCitymaster').blur(function(){
		if((this.value) == ''){ this.value = (this.defaultValue ? this.defaultValue : ''); }
	});
		
	/*Tabs*/
	$('.tab_nav a').click(function(){
		$('.tabs > div').hide().filter(this.hash).show();
		
		$('.tab_nav li').removeClass('tab_activ');
		$(this).parent().addClass('tab_activ');
		
		return false;
	}).filter(':first').click();
	
	$(".blue_btn:last").css({"margin-right":"0"});
	
	/*About pages*/
	$('.ab_link a').click(function(){
		$('.ab_link a').removeClass('ab_actv');
		$(this).addClass('ab_actv');
		$('.ab_c_box > div').hide().filter(this.hash).show();
		return false;
	}).filter(':first').click();
	
	/*Dailog box*/
	function maskDiv(){
	    $('.mask').css( {filter:'alpha(opacity=40)'});
	    $('.mask').fadeIn(200);
        $('.dialog_box input[type="text"]').filter(':first').focus();
	}			
    $(".close, #close").click(function(){
        $('.dialog_box').fadeOut(100); $('.mask').fadeOut(200);
    });
	
	$("#login, #ctl00_login").click(function(){
        $('#login_d').fadeIn(100);
        maskDiv();
    });
	
	$("#add_ur_busi").click(function(){
        $('#add_ur_busi_d').fadeIn(100);
        maskDiv();
    });
	$('*').keypress(function(e){
		if(e.keyCode == 0 || e.keyCode == 27){
			$('.mask').fadeOut(200);
			$('#result_main').css('visibility','hidden');
		;}
	});
	
	
	/*Find me on*/
	$('#find_me_d').css({opacity:'0',filter:'aplpha(opacity=0)'});
	$('#find_me').hover(
		function(){	
			$(this).children('#find_me_d').stop().animate({opacity:'1'}, 350).css({display:'block'});
		},				
		function(){
			$(this).children('#find_me_d').stop().animate({opacity:'0'}, 100).css({display:'none'});
		}
	);
	
	/*Localities remove*/
	$('.localiti_selct a.close').click(function(){
		$(this).parent().parent('.dialog_t').fadeOut(90);
		//$('.localiti_selct .dialog_t').fadeOut(50);
		return false;
	});
	$('#rem_all_locali').click(function(){	
		$('.localiti_selct .dialog_t').fadeOut(90);
		return false;
	});
	
	/*Navigation*/
	$('.nav > li > a').click(function(){
		$('.nav > li > a').removeClass('active1')
		$(this).addClass('active1');
		
		$('.nav > li > ul').hide();
		$(this).parent().children('ul').show();
	});
	
	$('.nav > li > ul > li > a').click(function(){
		$('.nav > li > ul > li > a').removeClass('active2');
		$(this).addClass('active2');
	});
	
	/*Change city*/
	$('.changec').hover(
		function(){ 
			$(this).addClass('actser_b', this).children('div').show();
		},
		function(){ 
			$(this).removeClass('actser_b', this).children('div').hide();
		}
	);
		
	$('.changec a').click(function(){								   		
		var cityTxt = $(this).text();
		$('.changec span').empty().append(cityTxt);
		$('#txtCitymaster').val('Which part of '+cityTxt+'?');
		
		$('#city_c').val(cityTxt);
		
		$('.changec div').hide();				
	});
	
	
	/*clasi_ext_link*/
	$('#yellow, #movie, #classi, #events').click(function(){$('.clasi_ext_link').hide(); });
	$('#classi').click(function(){$('.clasi_ext_link').show(); });	
	$('.clasi_ext_link a').click(function(){ $('.clasi_ext_link a').removeClass('active_cel'); $(this).addClass('active_cel'); });
	
	/*Real stae Mobile btn*/
	$('#rel_mobile_btn').click(function(){ $('#rel_mobile').show(); $(this).remove(); return false; });
	
	/*Post Ad*/
	$('input[value="yes"]').attr("checked", "checked");
	$('input[name="red_pa"]').change(function(){
		if($('input[name="red_pa"]:checked').val() == 'yes'){
				$('#red_pa_Y').show();	$('#red_pa_N').hide();
		}
		else{
			if($('input[name="red_pa"]:checked').val() == 'no'){
				$('#red_pa_N').show();	$('#red_pa_Y').hide();
			}
		}
	});
		
	/*UserProfile*/
	$('.user_links a').click(function(){								  
		$('.user_links li').removeClass('activuser');
		$(this).parent('li').addClass('activuser');		
		$('.user_pro > div').hide().filter(this.hash).show();
		return false;
	});
	
	$('#edite_pro').click(function(){
		$('#edite_mode').show();
		$('#profile_dl').hide();
	});
	$('#cancle_prodl').click(function(){
		$('#edite_mode').hide();
		$('#profile_dl').show();
	});
	
	
	/*Movies*/
	$('.m_src input[type="text"]').focus(function(){
		$(this).css({background:'#fff', border:'0', outline:'0', color:'000'});
		
	});
	$('.m_src input[type="text"]').blur(function(){
		$(this).css({background:'#fff', border:'0', outline:'0' , color:'000'});
	});
	
	$('.m_src li').hover(
		function(){ $(this).children('div').show();}, 
		function(){$(this).children('div').hide();}
	);
	
	$('.m_src li > div a').click(function(){
		$(this).parent().parent().find('input').val($(this).text()); $(this).parent('div').hide();
	});
	
	/*Movies list*/
	$('.movi_time li:even').addClass('gray_ev');
	
	/*Add your Business*/
	$('input[value="yes"]').attr("checked", "checked");
	$('input[name="ad_busin"]').change(function(){
		if( $('input[name="ad_busin"]:checked').val() == 'yes'){
			$('#List_your').show();	$('#Refer_Busi').hide();
			//console.log('wokring');
		}
		if( $('input[name="ad_busin"]:checked').val() == 'no'){
			$('#Refer_Busi').show(); $('#List_your').hide();
		}
	});
	
	/*Number scroll Animate*/
	$(window).scroll(function () { 
		var scrollTop = $(window).scrollTop() + 150;					
		$(".call_no").stop().animate({'top': scrollTop }, 1000);
	});
	$('.call_no div').click(function(){
		$(this).parent().remove();
	});	
});
