$(document).ready(function(){

	$('a[rel=external]').click(function(){
		window.open( $(this).attr('href') );
		return false;
	}); 

	$('input[type="text"]').addClass('typeText');

	$('#IPsearch').focus(function() {
		if( $(this).val()=='Search Here' )
			$(this).val('');	
	});
	

	$('#IPsearch').blur(function() {
		if( $(this).val()=='' )
			$(this).val('Search Here');	
	});


	$('#search').submit(function() {
		if($('#IPsearch').val() == '' || $('#IPsearch').val() == 'Search Here')
		return false;
	});

	$('#security_code').focus(function() {
		if( $(this).val()=='case sensitive' )
			$(this).val('');	
	});
	

	$('#security_code').blur(function() {
		if( $(this).val()=='' )
			$(this).val('case sensitive');	
	});


	$('.replybtn').click(function(){
	
		var comment = $(this).parent();
		
		$.get("/ajax/form-comments.php", { blogid: $('#blogid').val(), commentid: $(this).attr('id') },
			function(data){
			comment.append(data);
		});
		
		$(this).remove();


		$(".commentForm").parent().remove();
		
	});



	$('#careerCategory').change(function() {

		if($(this).val().length > 0)
		{
			window.location = "?c=" + $(this).val();
		} else {
			window.location = window.location.href.replace(window.location.search,'');
			
		}

		
	});



	$('#memberCategory').change(function() {

		if($(this).val().length > 0)
		{
			window.location = "?c=" + $(this).val();
		} else {
			window.location = window.location.href.replace(window.location.search,'');	
		}

		
	});


	$('#newsCategory').change(function() {

		if($(this).val().length > 0)
		{
			window.location = "?c=" + $(this).val();
		} else {
			window.location = window.location.href.replace(window.location.search,'');	
		}

		
	});


		$("a").tooltip({
		track: true,
		delay: 750,
		showURL: false,
		showBody: " - ",
		fade: 250
	});


	$('#allMemberCategories').hide();
	
	$('#memCatPicker').toggle(function(){
		$('#allMemberCategories').slideDown('fast');
	},function() {
		$('#allMemberCategories').slideUp('fast');
	});



});



function loadDirMaps()
{
	$('.gMap').each(function() {

		var map;

		var myOptions = {
			zoom: 14,
				center: window[$(this).attr('id')],
				mapTypeId: google.maps.MapTypeId.TERRAIN
		};

		map = new google.maps.Map(document.getElementById($(this).attr('id')), myOptions);
		
		var marker = new google.maps.Marker({
			position: window[$(this).attr('id')], 
			map: map
		});


	
	});


}

