//
// This file is part of the Siruna project (www.siruna.com).
//
// Copyright (c) 2007 IBBT  vzw., Gaston Crommenlaan 8, 9050 Ledeberg, BELGIUM
// and Universiteit Gent,  St Pieters nieuwstraat 25, 9000 Gent, BELGIUM 
// Authors:   Jan Hollez, Dieter Van de Walle, Davy Van Deursen, Gregory De Jans
// Technical Management & Software Architecture: Frank Gielen
//

//Initialize our user agent string.
var uagent = navigator.userAgent.toLowerCase();

var mobileStrings = ["windows ce", "palm", "ppc", "mobile", "pda", "mini", "mmp", "symbian", "series60", "series70", "series80", "series90", "netfront", "pie", "midp", "blackberry", "wap", "wml", "phone", "pocket", "brew", "psp", "ipod", "pirelli", "nitro", "docomo", "plucker", "xiino", "portalmmm", "blazer", "up.browser", "up.link", "regking", "amstrad", "epoc", "reqwirelessweb", "armv5tel", "playstation", "proxinet", "elaine"];

var mobilePrefixes = ["acs-", "alav", "alca", "amoi", "audi", "aste", "avan", "au-m", "benq", "bird", "blac", "blaz", "brew", "cell", "cldc", "cmd-", "dang", "doco", "eric", "epoc", "hipt", "inno", "ipaq", "java", "jigs", "kddi", "keji", "leno", "lg-c", "lg-d", "lg-g", "lge-", "maui", "maxo", "midp", "mits", "mmef", "mobi", "mot-", "moto", "mwbp", "nec-", "newt", "noki", "opwv", "palm", "pana", "pant", "pdxg", "phil", "play", "pluc", "port", "prox", "qtek", "qwap", "sage", "sams", "sany", "sch-", "sec-", "send", "seri", "sgh-", "shar", "sie-", "siem", "smal", "smar", "sony", "sph-", "symb", "t-mo", "teli", "tim-", "tosh", "tsm-", "upg1", "upsi", "vk-v", "voda", "w3c ", "wap-", "wapa", "wapi", "wapp", "wapr", "webc", "winw", "winw", "xda", "xda-"];

function mobiledevicedetection(){
	if (isMobileDevice())
	{
        document.location.href = "http://m.brusselsairlines.com";	
    }
	else
	{
		document.location.href = "default.aspx";
		}
}

function isMobileDevice(){
    if (uagent.search('ppc mac os') > -1){
        return false;
    }
    
    var counter = 0;   
    for (counter = 0; counter < mobileStrings.length; counter++){
        if (uagent.search(mobileStrings[counter]) > -1){
            return true;
        }
    }
    if (uagent.length >= 4){
        for (counter = 0; counter < mobilePrefixes.length; counter++){
            if (uagent.substring(0,4) == mobilePrefixes[counter]){
                return true;
            }
        }
    }
    return false;
};



