
//function isiPad() {
//    return (navigator.platform.indexOf("iPad") != -1);
//}

function isiDevice() {
    return (
        (navigator.platform.indexOf("iPad") != -1) ||
        (navigator.platform.indexOf("iPhone") != -1) ||
        (navigator.platform.indexOf("iPod") != -1)
    );
}
function setbodyclassiDevice() {

    if (isiDevice()) {
        document.getElementsByTagName("body")[0].setAttribute("class", "iDevice");
        //alert("iDevice")
    }
    else {
        //alert("not iDevice")
    }
}

//test for ipad/mobile safari
//if(isiPad){jQuery("body").addClass("jq");}

//test for javascript browsers
//document.getElementsByTagName("body")[0].setAttribute("class", "js");

//in css apply like this:
//.someClass{display:block;}
//.js .someClass{display:none;}

//test for jQuery Browsers
//if(jQuery){jQuery("body").addClass("jq");}
//OR below version avoids apparent problem in IE8 with undefined variables
//try {
//    var jqueryIsLoaded = jQuery;
//    jQueryIsLoaded = true;
//}
//catch (err) {
//    var jQueryIsLoaded = false;
//}

//if (jQueryIsLoaded) {
//}
//else {
//}



function changecss(theClass, element, value) {
    //Last Updated on June 23, 2009
    //documentation for this script at
    //http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
    var cssRules;

    var added = false;
    for (var S = 0; S < document.styleSheets.length; S++) {

        if (document.styleSheets[S]['rules']) {
            cssRules = 'rules';
        } else if (document.styleSheets[S]['cssRules']) {
            cssRules = 'cssRules';
        } else {
            //no rules found... browser unknown
        }

        for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
            if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
                if (document.styleSheets[S][cssRules][R].style[element]) {
                    document.styleSheets[S][cssRules][R].style[element] = value;
                    added = true;
                    break;
                }
            }
        }
        if (!added) {
            if (document.styleSheets[S].insertRule) {
                document.styleSheets[S].insertRule(theClass + ' { ' + element + ': ' + value + '; }', document.styleSheets[S][cssRules].length);
            } else if (document.styleSheets[S].addRule) {
                document.styleSheets[S].addRule(theClass, element + ': ' + value + ';');
            }
        }
    }
}
