// JavaScript Document

// Variables
var rec_browser = "Prosím vyskúšajte iný prehliadač(IE,FireFox alebo Operu )";
var browser_redir = "http://www.mozilla.sk/";
var en_url = "http://www.e-bicycles.eu/en/index.html";
var cz_url = "http://www.e-bicycles.eu/cz/index.html";
var sk_url = "http://www.e-bicycles.eu/index.html";
Event.cancelBubble = true;


// Images Functions

// Flag - language redirection
function sel_lang(lang){
if (lang == 'en') {document.location = en_url;}
else if (lang == 'cz') {document.location = cz_url;}
else {document.location = sk_url;}
}

// Dynamic - Increase image
function increase(obj, min, max, ratio) {
timer = null;
obj.onmouseout = null; // block event - Prevent Image blinking
    if(obj.width < max) {
        obj.width += 10;
        obj.height += Math.round(10/ratio);  // ratio = width/height of image
           timer = setTimeout(function() {increase(obj, min, max, ratio)}, 3); // setTimeout insert parameters
    } else {
        clearTimeout('timer');
        obj.onmouseout = function anonymous() {decrease(this, min, max, ratio)}; // Activate Event again
        
        
    }
}
// Dynamic - Decrease image
function decrease(obj, min, max, ratio) {
obj.onmouseover = null;   // block event - Prevent Image blinking
timer = null;
    if(obj.width > min) {
        obj.width -= 10;
        obj.height -= Math.round(10/ratio); // ratio = width/height of image
           timer = setTimeout(function() {decrease(obj, min, max, ratio)}, 3); // setTimeout insert parameters
    } else {
        clearTimeout('timer');
        obj.onmouseover = function anonymous() {increase(this, min, max, ratio)}; // Activate Event again
    }
}

// Enlarge Image Function 
function showImg(imgSrc, H, W, Caption) {
var newImg = window.open("","myImg",config="height="+H+",width="+W+"+status=no"+"");
newImg.document.write("<title>"+ Caption +"</title>");
newImg.document.write("<img src='"+ imgSrc +"' height='"+ H +"' width='"+ W +"' onclick='window.close()' style='position:absolute;left:0;top:0'>");
newImg.document.write("<script type='text/javascript'> document.oncontextmenu = new Function(\"return false\") </sc"+"ript>");
newImg.document.close();
}

// Shift the side menu  
function menu_shift() {
var mXoffset = 15;
var pos = document.getElementById('imSite').offsetLeft + mXoffset;
//var pos2 = document.getElementById('basessm').offsetLeft;

if (document.getElementById('basessm')) {
      document.getElementById('basessm').style.left = pos;
      document.getElementById("basessm").style.visibility = "visible";
      document.getElementById("thessm").style.visibility = "visible";
      }
else {alert(rec_browser); document.location = browser_redir; }
}


