//**************************
// Detects if the current device is a GoogleTV.
var deviceAndroid = "android";
var deviceGoogleTV = "googletv";
var deviceXoom = "xoom"; //Motorola Xoom
var deviceHtcFlyer = "htc_flyer"; //HTC Flyer

function DetectGoogleTV() {
    if (navigator.userAgent.toLowerCase().search(deviceGoogleTV) > -1)
return true;
    else
return false;
}
function DetectAndroid() {
    if ((navigator.userAgent.toLowerCase().search(deviceAndroid) > -1) || DetectGoogleTV())
return true;
    //Special check for the HTC Flyer 7" tablet. It should report here.
    if (navigator.userAgent.toLowerCase().search(deviceHtcFlyer) > -1)
return true;
    else
return false;
}

//**************************
// Detects if the current device is a (small-ish) Android OS-based device
// used for calling and/or multi-media (like a Samsung Galaxy Player).
// Google says these devices will have 'Android' AND 'mobile' in user agent.
// Ignores tablets (Honeycomb and later).
function DetectAndroidPhone() {
    if (DetectAndroid() && (navigator.userAgent.toLowerCase().search("mobile") > -1))
return true;
    //Special check for the HTC Flyer 7" tablet. It should report here.
    if (navigator.userAgent.toLowerCase().search(deviceHtcFlyer) > -1)
return true;
    else
return false;
}

function QuickSetCookie(c_name, value, exdays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
    document.cookie = c_name + "=" + c_value;
}
