var editWindow;
var baseImg;

function openArticleEdit(contextPath, id, articleid, name, width, height, slaveLang) {
    var popupWidth = (width<288?288:width)+23;
    var popupHeight = slaveLang?(height*2+160):(height+110);
        popupHeight = popupHeight<=screen.height?(popupHeight):(screen.height-90);
    editWindow = window.open(contextPath + "/de/index.htm","editContent","width="+popupWidth+",height="+popupHeight+",resizeable=auto,scrollbars=no");
    editWindow.close();
    editWindow = window.open(contextPath + "/admin/editContent.htm?id="+id+"&articleid="+articleid+"&name="+name+"&twidth="+width+"&theight="+height+"&tpopupHeight="+popupHeight,"editContent","width="+popupWidth+",height="+popupHeight+",resizeable=auto,scrollbars=no");
    editWindow.focus();
    return false;
}

function openColorEdit(contextPath, articleid, width, height) {
    editWindow = window.open(contextPath + "/admin/editColor.htm?articleid="+articleid,"editColor","width="+width+",height="+height+",resizeable=auto,scrollbars=yes");
    editWindow.resizeTo(width, height);
    editWindow.focus();
    return false;
}

function openRecommendation(url) {
    recomWindow = window.open(url, "recommendation", "width=500,height=420,status=yes,scrollbars=no,resizable=no");
    recomWindow.focus();
}

function printPage() {
    if(navigator.userAgent.indexOf("Mac") == -1) window.print();
}

function mOver(img, val) {
    try {
        val = val.substring(val.lastIndexOf('/')+1,val.lastIndexOf('.'));
        var imgSrc = '/data/Generated/Productselection/'+val+'.jpg';
//            var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
//            xmlHttp.open("HEAD", imgSrc, false);
//            xmlHttp.send();
//            if(xmlHttp.status!='200') return;
        baseImg = document.getElementById(img).src;
        document.getElementById(img).src = imgSrc;
    } catch (e) {}
}

function mOut(img) {
    try {
        if(baseImg) document.getElementById(img).src = baseImg;
    } catch (e) {}
}
