/*
	Author: Ashan Jay
	Author website: http://www.ashanjay.com
*/

function general(){
	$('#main_askNY_q_block').hover(function(){
		$(this).addClass('main_q_box');
	},function(){
		$(this).removeClass('main_q_box');
	});
	
	//input field hover
	$('#main_askNY_temp').focus(function(){
		$(this).hide();
		$('#search').show().focus();
	});
	$('#search').blur(function(){
		if($(this).val()==''){
			$(this).hide();
			$('#main_askNY_temp').show();
			//$(this).val("");
		}
	});

	show_pop_up_boxes();
}

// to show pop-up box within window
function show_pop_up_boxes(){
	$('.show_pop_up_win_btn').click(function(){
		var theID = '';
		var author = $('#the_author_name_is').html();
		
		if($(this).attr('name')=='ask_question'){
			theID = 'ath_ask_question';
			$('#field11021549').val(author);	
			
		}else if($(this).attr('name')=='ath_consultation'){
			theID = 'ath_consultation';
			$('#field11021313').val(author);
		}
		$('.pop_box_title').html($(this).attr('text'));	
		$('#'+theID).show();
		lefty('#'+theID);
		
	});
	$('.close').click(function(){
		$('.pop_box').hide();
	});
}

//get the height of right column and match it to left side
function inpage_height(){
	var hei = $('#page_content').height();
	var heit =(hei>600)? hei: 600;
	//$('#page_right_column')
		//.height(heit);
}

// focus input fields provide id of real input
function input_field_focus(var1){
	$('#'+var1+'_temp').focus(function(){
		$(this).hide();
		$('#'+var1).show().focus();
	});
	$('#'+var1).blur(function(){
		if($(this).val() == ''){			
			$(this).hide();
			$('#'+var1+'_temp').show();
			//$(this).val("");
		}
	});
}

//to measure left margin
function lefty(vari){
	var wit= $(vari).width();
	var Hwi=$(window).width();	
	var pect=parseInt((((Hwi- wit)/2)/Hwi)*100);	
	$(vari).css('left', pect+'%');

}
