﻿function pageWidth() { return window.innerWidth != null ? window.innerWidth :document.documentElement&& document.documentElement.clientWidth ?document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null; }
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 + ';');
            }
        }
    }
}
jQuery.fn.zoom = function(fn) {
  jQuery(document).keydown(function(e){
    switch (true) {
      case jQuery.browser.mozilla || jQuery.browser.msie :
        if (e.ctrlKey && (
          e.which == 187 ||
          e.which == 189 ||
          e.which == 107 ||
          e.which == 109 ||
          e.which == 96  ||
          e.which == 48
        )) fn();
        break;
      case jQuery.browser.opera :
        if (
          e.which == 43 ||
          e.which == 45 ||
          e.which == 42 ||
          (e.ctrlKey && e.which == 48)
        ) fn();
        break;
      case jQuery.browser.safari :
        if (e.metaKey && (
          e.charCode == 43 ||
          e.charCode == 45
        )) fn();
        break;
    }
    return;
  });

  jQuery(document).bind('mousewheel', function(e){
    if (e.ctrlKey) fn();
  });

  jQuery(document).bind('DOMMouseScroll', function(e){
    if (e.ctrlKey) fn();
  });
};


function fullScreen() {
    xs = screen.availWidth;
    ys = screen.availHeight;
    window.moveTo(0, 0);
    window.resizeTo(xs, ys);
}
fullScreen();
if (jQuery('#slogan_ar')) {
    jQuery('#slogan_ar').css("right", (pageWidth() - jQuery('#slogan_ar').width()) / 2);
    jQuery('body').resize(function() {
        jQuery('#slogan_ar').css("right", (pageWidth() - jQuery('#slogan_ar').width()) / 2);


    });
}
if (jQuery('#slogan')) {
    jQuery('#slogan').css("left", (pageWidth() - jQuery('#slogan').width()) / 2);
    jQuery('body').resize(function() {
    jQuery('#slogan').css("left", (pageWidth() -jQuery('#slogan').width())/ 2);
    
    jQuery().zoom(function(){
            jQuery('#slogan').css("left", (pageWidth() - jQuery('#slogan').width()) / 2);
        });
        
    });
}
