var cbe_ua = function(url){
	//window.location = url;
    this.deviceIphone = "iphone";
    this.deviceIpod = "ipod";
    this.deviceIpad = "ipad";
    this.deviceAndroid = "android";
	this.deviceBlackberry = "Blackberry";

    this.scr = url;
    
    this.init = function(){
        if((this.isAndroid() || this.isIpod() || this.isIpad() || this.isIphone() || this.isBlackberry())){
            window.location = this.scr;
        }
    };

    this.getUserAgent = function(){
        return navigator.userAgent.toLowerCase();
    }    

    //Return true is the device is an Android
    this.isAndroid = function(){
        if (this.getUserAgent().indexOf(this.deviceAndroid) > -1)
			return true;
        else
            return false;
    }

    //Return true is the device is an Ipod
    this.isipod = function (){
        if (this.getUserAgent().indexOf(this.deviceipod) > -1)
			return true;
        else
            return false;
    }

    //Return true is the device is an Ipad
    this.isipad = function (){
        if (this.getUserAgent().indexOf(this.deviceipad) > -1)
			return true;
        else
            return false;
    }

    //Return true is the device is an Iphone
    this.isiphone = function(){
        if (this.getUserAgent().indexOf(this.deviceiphone) > -1)
			return true;
        else
            return false;
    }

    //Return true is the device is an Blackberry
    this.isBlackberry = function(){
        if (this.getUserAgent().indexOf(this.deviceBlackberry) > -1)
			return true;
        else
            return false;
    }

    this.init();
};

new cbe_ua('http://www.luxurycostaricarental.com/');
