function getQuerystring(key, default_)
{
  if (default_==null) default_=""; 
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
    return default_;
  else
    return qs[1];
}

function isMobile(alias,itemLevel,itemID) {
	if (getQuerystring('fullscreen') == 'true') {
		return;
	}
	if ( navigator.userAgent.match ( /(android|blackberry|htc|ipaq|iphone|ipad|ipod|kindle|lg|midp|mmp|mobile|mot|nokia|o2|opera mini|palm|pocket|psp|sgh|smartphone|sonyericsson|symbian|treo mini|up.browser|up.link|vodafone|wap)/i) ) {
		location.replace('http://'+alias+'/'+itemLevel+'/'+itemID);
	}
}

////	here's what to put in the header on the pages the client wants redirected
////	
////	tappinn.com can be changed to an alias on the system without the http
////	p can be either 'c' or 'p' (for pointing to a code or page)
////	474 is the ID of the code or page
/*	
<script src="http://www.tappinn.com/public/js/detectmobile/tappinnmobiledetect.js" type="text/javascript"></script>
<script type="text/javascript"> isMobile('tappinn.com','p',474); </script>
*/

