/**
 * @author <GOLF>
 * @email <golf@turkenterprisesinc.com>
 * @date 01/23/2012 04:10 PM.
 */

/* [Return `true` if url contains 'mobile'] */
function isMobile(){
	var current_url = location.href;		// Get current url.
	var url_pattern = /mobile*/i			// Create pattern finding `mobile` url.
	var chkMobile = current_url.match(url_pattern) == 'mobile' ? true : false;
	return chkMobile;
}

/* Links to the mobile version if mobile attribute is specified, and linked click on mobile site */
$(document).ready(function(){
	if(isMobile())
		$('a[mobile]').each(function(i){
			$(this).attr('href', $(this).attr('mobile'));
		});
});

