var sgdMobileClients=[
"midp",
"240x320",
"amoi",
"blackberry",
"netfront",
"nokia",
"panasonic",
"portalmmm",
"sharp",
"sie-",
"sonyericsson",
"symbian",
"windows ce",
"benq",
"mda",
"mot-",
"opera mini",
"philips",
"pocket pc",
"sagem",
"samsung",
"sda",
"sgh-",
"vodafone",
"xda",
"iphone",
"ipod",
"android",
"au-mic",
"audiovox",
"brew",
"cellphone",
"htc",
"iemobile",
"ipaq",
"kwc-",
"lg-",
"lg/",
"lge-",
"mobilephone",
"motorola",
"nintendo",
"palm",
"sanyo",
"sch-",
"smartphone",
"zte-"
];
function sgdIsMobileClient(userAgent) {
	try {
		userAgent=userAgent.toLowerCase();
		for (var i=0; i < sgdMobileClients.length; i++) {
			if (userAgent.indexOf(sgdMobileClients[i]) != -1) {
				return true;
			}
		}
	}
	catch (e) {
	}
	return false;
}
function sgdIsThisBrowserMobileClient() {
	return sgdIsMobileClient(navigator.userAgent);
}
function sgdRedirectIfMobileClient() {

	try {
		if (sgdIsThisBrowserMobileClient()) {
			if (document.location.href.indexOf('nomobile') != -1) {
				document.cookie='nomobile';
				return;
			}
			if (document.cookie && document.cookie.indexOf('nomobile') != -1) {
				return;
			}
			document.location.href="http://m.sgd.de/index.php?"+get_GET_params();
		}
	}
	catch (e) {
	}
}

function get_GET_params() {
   var GET = new Array();
   var sendToMobile = new String();
   if(location.search.length > 0) {
      var get_param_str = location.search.substring(1, location.search.length);
      var get_params = get_param_str.split("&");
      for(i = 0; i < get_params.length; i++) {
         var key_value = get_params[i].split("=");
         if(key_value.length == 2) {
            var key = key_value[0];
            var value = key_value[1];
            GET[key] = value;
         }
		 sendToMobile = sendToMobile + key + '=' + value + '&';
      }
   }
   sendToMobile = sendToMobile.substring(0,sendToMobile.length-1);
   return(sendToMobile);
}


