﻿
var tab_auswahl = ':first';
$(function() {

    var tabContainers = $('div.tabs > div');
    tabContainers.hide().filter(tab_auswahl).show();

    $('div.tabs ul.tabNavigation a').click(
	            function() {
	                if (this.hash != '#first') {
	                    if (this.style.color == '#010101') {
	                        alert('Bitte benutzen Sie zuerst den Button "Weiter >>"');
	                        return false;
	                    }
	                }
	                tabContainers.hide();
	                tabContainers.filter(this.hash).show();
	                $('div.tabs ul.tabNavigation a').removeClass('selected');
	                $(this).addClass('selected');
	                return false;
	            }
            ).filter(tab_auswahl).click();

});

function SetTabOK(someVarTab, sVarlIOK, sVarlIFrei) {
    try {
        document.getElementById(sVarlIOK).style.color = '#005F00';
        document.getElementById(sVarlIFrei).style.color = '#000000';
    }
    catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
        //        alert(txt);
    }
}

function SetTextNeu(someVarTab, sVarlI) {
    if (!IstFlash.installed) {
        try {
            var divMultiUpload = document.getElementById('DIVMultiUpload');
            divMultiUpload.style.display = 'none';
        }
        catch (err) {
        }
    } else {
        try {
            var divSingleUpload = document.getElementById('DIVSingleUpload');
            divSingleUpload.style.display = 'none';
        }
        catch (err) {
        }
    }
    /////////////////////////////////////////7
    tab_auswahl = someVarTab;
//    OnSetTab(someVarTab, sVarlI);
    OnSetLi(sVarlI);

    if (sVarlI == 'li_5') {
        var divBeschreibung = document.getElementById('DivContentBeschreibung');
        divBeschreibung.style.display = 'none';
    }
}
function OnSetTab(sVarTab, sVarlI) {
    tab_auswahl = sVarTab;
    var tabContainers = $('div.tabs > div');
    tabContainers.hide().filter(tab_auswahl).show();
    OnSetLi(sVarlI);
}

function OnClickSetLi(sVarlI) {
    if (document.getElementById(sVarlI).style.color == '#010101') {
        return false;
    }
    OnSetLi(sVarlI);
}


function OnSetLi(sVarlI) {

    try {
//        var LabelLi1 = document.getElementById('li_1');
        //        LabelLi1.style.backgroundColor = "white";

        document.getElementById('li_1').className = document.getElementById('li_1').className.replace(' tabboxOn','')
        document.getElementById('li_2').className = document.getElementById('li_2').className.replace(' tabboxOn','')
        document.getElementById('li_3').className = document.getElementById('li_3').className.replace(' tabboxOn','')
        document.getElementById('li_4').className = document.getElementById('li_4').className.replace(' tabboxOn','')

        //  var LabelLi = document.getElementById(sVarlI);
        //// set select color
        //  LabelLi.style.backgroundColor = "#A0FFC8";
        document.getElementById(sVarlI).className += " tabboxOn";

        if (sVarlI == 'li_1') {
            var divBeschreibung = document.getElementById('DivContentBeschreibung');
            divBeschreibung.style.display = 'block';
        } else if (sVarlI == 'li_2') {
            var divBeschreibung = document.getElementById('DivContentBeschreibung');
            divBeschreibung.style.display = 'block';
        } else {
            var divBeschreibung = document.getElementById('DivContentBeschreibung');
            divBeschreibung.style.display = 'none';
        }
    }
    catch (err) {
        txt = "There was an error on this page.\n\n";
        txt += "Error description: " + err.description + "\n\n";
        txt += "Click OK to continue.\n\n";
//        alert(txt);
    }
}

function FilterNumeric() {
    if (window.event) // IE
    {
        var ch = String.fromCharCode(event.keyCode);
        if (event.keyCode < 32) {
            return;
        };

        if ((event.keyCode <= 57) && (event.keyCode >= 44)) {
            if (!event.shiftKey) {
                return;
            }
        }

        if ((event.keyCode <= 43) && (event.keyCode >= 40)) {
            return;
        }
        event.returnValue = false;
    }
}

function SetFormatBerechnung(box, idList) {
   
    var DropDownListBoxDiv;
    var LabelAusgabe;
    DropDownListBoxDiv = document.getElementById('ctl00_ContentPlaceHolder1_' + idList);
    LabelAusgabe = document.getElementById('ctl00_ContentPlaceHolder1_TextBoxPreis');

    for (var n = 0; n < DropDownListBoxDiv.length; ++n) {
        if (DropDownListBoxDiv[n].selected) {
            try {
                var sVal = DropDownListBoxDiv[n].value;
                LabelAusgabe.value = sVal;
            }
            catch (err) {
            }
        }}
}

$(document).ready(function(){
$(function () {
//    $('#DivContentWerbung').load('Werbung/Plakate_Werbung.html');
});
});

function HTMLBeschreibungOut(sTextBeschreibung, sTextWerbung) {
    try {
        $('#DivContentWerbung').load(sTextWerbung);
        $('#DivContentBeschreibung').load(sTextBeschreibung);
    }
    catch (err) {
    }
}

function ClearFileUpload() {

    try {
    }
    catch (err) {
    }

}

var sJaNeinParameter = "";
function ConfirmMotive(sText) {
    var Check = false;
    try {
        sJaNeinParameter = sText;
        xShowModalDialog("JaNeinDialog.htm", window, "status:false;dialogWidth:490px;dialogHeight:120px");

        if (sJaNeinParameter != sText) {
            Check = true;
        }
    }
    catch (err) {
        try {
            var Check = confirm(sText);
        }
        catch (err) {
            alert(err.description);
        }
    }
    try {
        if (Check == true) {
            SetTextNeu('#first', 'li_1')
            var xRefreshButton = document.getElementById("ctl00_ContentPlaceHolder1_ButtonRefreschMotive");
            xRefreshButton.click();
        }
    }
    catch (err) {
        alert(err.description);
    }
}
function fnUpdate() {
    var xRefreshButton = document.getElementById("ctl00_ContentPlaceHolder1_ButtonRefreschMotive");
    xRefreshButton.click();
}

var sOKParameter = "";
function fnOKDialog(sText) {
    try {
        sJaNeinParameter = sText;
        xShowModalDialog("OKDialog.htm", window, "center:yes;status:false;dialogWidth:490px;dialogHeight:120px;");
    }
    catch (err) {
        alert(sText);
    }
}

/* 
Notes: 
1. edge & help attributes do not work. 
2. "height" & "width" must be entered before "center" 
3. if you should choose to set "center=yes" do not put in "left" and "top" 
4. Minimize button not hidden, but when clicked the window will not disappear 
5. Aside from the aforementioned, all features should react the same *fingers crossed* 
6. Still in the works, so don't expect miracles. Any problems/queries/complaints please don't hesitate. 
Email: 
[email]x_goose_x@hotmail.com[/email] 
*/

dFeatures = 'dialogHeight: 450px; dialogWidth: 1049px; dialogTop: 646px; dialogLeft: 4px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;'; //default features 

modalWin = "";
function xShowModalDialog(sURL, vArguments, sFeatures) {
    if (sURL == null || sURL == '') {
        alert("Invalid URL input.");
        return false;
    }
    if (vArguments == null || vArguments == '') {
        vArguments = '';
    }
    if (sFeatures == null || sFeatures == '') {
        sFeatures = dFeatures;
    }
    if (window.navigator.appVersion.indexOf("MSIE") != -1) {
        window.showModalDialog(sURL, vArguments, sFeatures);
        return false;
    }
    sFeatures = sFeatures.replace(/ /gi, '');
    aFeatures = sFeatures.split(";");
    sWinFeat = "directories=0,menubar=0,titlebar=0,toolbar=0,";
    for (x in aFeatures) {
        aTmp = aFeatures[x].split(":");
        sKey = aTmp[0].toLowerCase();
        sVal = aTmp[1];
        switch (sKey) {
            case "dialogheight":
                sWinFeat += "height=" + sVal + ",";
                pHeight = sVal;
                break;
            case "dialogwidth":
                sWinFeat += "width=" + sVal + ",";
                pWidth = sVal;
                break;
            case "dialogtop":
                sWinFeat += "screenY=" + sVal + ",";
                break;
            case "dialogleft":
                sWinFeat += "screenX=" + sVal + ",";
                break;
            case "resizable":
                sWinFeat += "resizable=" + sVal + ",";
                break;
            case "status":
                sWinFeat += "status=" + sVal + ",";
                break;
            case "center":
                if (sVal.toLowerCase() == "yes") {
                    sWinFeat += "screenY=" + ((screen.availHeight - pHeight) / 2) + ",";
                    sWinFeat += "screenX=" + ((screen.availWidth - pWidth) / 2) + ",";
                }
                break;
        }
    }
    modalWin = window.open(String(sURL), "", sWinFeat);
    if (vArguments != null && vArguments != '') {
        modalWin.dialogArguments = vArguments;
    }
}

function checkFocus() {
    if (window.navigator.appVersion.indexOf("MSIE") == -1) {
        if (modalWin != null && !modalWin.closed) {
            self.blur();
            modalWin.focus();
        }
    }
} 


