// JavaScript Document
//short for pages functions

PF = {
		UI : {},
		UTIL: {}
};




//User interface					
//function use to show members login...
PF.UI.expandMembers = function(){
					jQuery('#logintab .inside').css({'display':'none'});
					jQuery('#logintab p span').css({'display':'block'});
					jQuery('#clicklogin').toggle(
												function () {
  															jQuery('#logintab .inside').show('fast');
  															jQuery('#logintab p span').text('hide');
															},

												function () {
															jQuery('#logintab .inside').hide('fast');
															jQuery('#logintab p span').text('show');


												})
					
};

		

					
PF.UI.clickable = (function($) {
	// plugin definition
	$.fn.bigTarget = function(options) {
		debug(this);
		// build main options before element iteration
		var opts = $.extend({}, $.fn.bigTarget.defaults, options);
		// iterate and reformat each matched element
		return this.each(function() {
			// set the anchor attributes
			var $a = $(this);
			var href = $a.attr('href');
			var title = $a.attr('title');
			// build element specific options
			var o = $.meta ? $.extend({}, opts, $a.data()) : opts;
			// update element styles
			$a.parents(o.clickZone)
				.hover(function() {
					$h = $(this);
					$h.addClass(o.hoverClass);
					if(typeof o.title != 'undefined' && o.title === true && title != '') {
						$h.attr('title',title);
					}
				}, function() {
					
					$h.removeClass(o.hoverClass);
					if(typeof o.title != 'undefined' && o.title === true && title != '') {
						$h.removeAttr('title');
					}
				})
				// click
				.click(function() {
					if(getSelectedText() == "")
					{
						if($a.is('[rel*=external]')){
							window.open(href);
							return false;
						}
						else {
							//$a.click(); $a.trigger('click');
							window.location = href;
						}
					}
				});
		});
	};
	// private function for debugging
	function debug($obj) {
		if (window.console && window.console.log)
		window.console.log(/*'bigTarget selection count: ' + $obj.size()*/);
	};
	// get selected text
	function getSelectedText(){
		if(window.getSelection){
			return window.getSelection().toString();
		}
		else if(document.getSelection){
			return document.getSelection();
		}
		else if(document.selection){
			return document.selection.createRange().text;
		}
	};
	// plugin defaults
	$.fn.bigTarget.defaults = {
		hoverClass	: 'hover',
		clickZone	: 'div:eq(0)',
		title		: true
	};
// end of closure
})(jQuery);
//clickable function ends here						

PF.UI.clickMe = function(){
	
	
		jQuery(".featured-post a").bigTarget();			

					
};

/*PF.UI.carusele = function(){
		jQuery(".lead_story").easySlider(prevText: 'Previous',
		nextText: 'Next',		
		firstShow: true,
		lastShow: true,
		vertical: true, 
		continuous: true);

    };*/





jQuery(document).ready(function() {
	//PF.UI.clickable($);

	PF.UI.expandMembers();
	PF.UI.clickMe();
	//PF.UI.carusele();
	
	//jQuery("#lead_story").easySlider();

	
	
	
});