/////////////////////////////////////////////////////////////////////////////////
(function($)
{
	
	
	$.fn.uvAlign = function() {
		return this.each(function(i){
		var ah = $(this).height();
		//console.log(ah);
		if(ah==0)ah=60;
		var ph = $(this).parent().height();
		//var ph =$(this).closest('.poi_photo2_round_border_inner').height();
		 //console.log(ph);
	 	var mh = '';
		
		if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
		 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
		 if (ieversion>=8)
    		mh = (ph - ah) / 2;
		 else if (ieversion>=7)
    		mh = 5;
		 else if (ieversion>=6)
    		mh = 5;
		 else if (ieversion>=5)
    		mh = 5;
		}
		else
		{
			mh = (ph - ah) / 2;
		}

		$(this).css('margin-top', mh);
		$(this).parent().corner();
		});
		
	};
	
	 
		
/*	$.fn.vAlign2 = function(container) {
		return this.each(function(i){
	   if(container == null) {
		  container = 'div';
	   }
	   var paddingPx = 10; //change this value as you need (It is the extra height for the parent element)
	   $(this).html("<" + container + ">" + $(this).html() + "</" + container + ">");
	   var el = $(this).children(container + ":first");
	   var elh = $(el).height(); //new element height
	   var ph = $(this).height(); //parent height
	   
	   if(elh > ph) { //if new element height is larger apply this to parent
		   $(this).height(elh + paddingPx);
		   ph = elh + paddingPx;
	   }
	   var nh = (ph - elh) / 2; //new margin to apply
	   $(el).css('margin-top', nh);
		});
	 };*/
	
	$.fn.defaultTextWithTitle = function(text,text2)
	{
		var $fi = $(this);
		var $fo = $fi.parents('form');
		
		// Set the default text if not already
		if ($fi.val() == '' || $fi.val() == text)
		{
			$fi.val(text2);
		}
		
		// React depending on presence of default text
		$fi.focus(function()
		{
			if ($fi.val() == '' || $fi.val() == text2)
			{
				$fi.val(text);
			}
		}).blur(function()
		{
			if ($fi.val() == '' || $fi.val() == text)
			{
				$fi.val(text2);
			}
		});
		
		// Make sure default text gets sent as nothing instead
		$fo.submit(function()
		{
			if ($fi.val() == text || $fi.val() == text2 )
			{
				$fi.val('');
			}
		});
		
		return this;
	};
	//////////////////////////////////////////
	
	$.fn.defaultText2 = function(text)
	{
		var $fi = $(this);
		var $fo = $fi.parents('form');
		
		// Set the default text if not already
		if ($fi.val() == '')
		{
			$fi.val(text);
		}
		
		// React depending on presence of default text
		$fi.focus(function()
		{
			if ($fi.val() == '')
			{
				$fi.val(text);
			}
		}).blur(function()
		{
			if ($fi.val() == '')
			{
				$fi.val(text);
			}
		});
		
		// Make sure default text gets sent as nothing instead
		$fo.submit(function()
		{
			if ($fi.val() == text)
			{
				$fi.val('');
			}
		});
		
		return this;
	};
	//////////////////////////////////////////
	
	
	
	$.fn.defaultText = function(text)
	{
		var $fi = $(this);
		var $fo = $fi.parents('form');
		
		// Set the default text if not already
		if ($fi.val() == '')
		{
			$fi.val(text);
		}
		
		// React depending on presence of default text
		$fi.focus(function()
		{
			if ($fi.val() == text)
			{
				$fi.val('');
			}
		}).blur(function()
		{
			if ($fi.val() == '')
			{
				$fi.val(text);
			}
		});
		
		// Make sure default text gets sent as nothing instead
		$fo.submit(function()
		{
			if ($fi.val() == text)
			{
				$fi.val('');
			}
		});
		
		return this;
	};
	
	$.fn.hoverFade = function(options)
	{
		var defaults = {
			opcIn: 1.0, 
			opcOut: 0.5, 
			speed: 100
		}, 
			settings = $.extend(defaults, options);
		
		this.each(function()
		{
			var $t = $(this);
			
			$t.css('opacity', settings.opcOut).hover(function()
			{
				$t.animate({ opacity: settings.opcIn }, settings.speed);
			}, function()
			{
				$t.animate({ opacity: settings.opcOut }, settings.speed);
			});
		});
		
		return this;
	};
	
	$.fn.idle = function(time)
	{ 
		var $t = $(this);
		
		$t.queue(function()
		{
			setTimeout(function()
			{
				$t.dequeue();
			}, time);
		});
		
		return this;
	};
})(jQuery);
//////////////////////////////////////////////////////////////////////////	$('#sub-name input').defaultText('Your name').prev().text('');
////////////////////////








