﻿//here you place the ids of every element you want.
//var ids=new Array('a1','a2','a3','thiscanbeanything');

function switchid(id) {
    hideallids();
    showdiv(id);
}

//function hideallids(){
//	//loop through the array and hide each element by id
//	for (var i=0;i<ids.length;i++){
//		hidediv(ids[i]);
//	}		  
//}

function hidediv(id) {
    //safe function to hide an element with a specified id
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.display = 'none';
    }
    else {
        if (document.layers) { // Netscape 4
            document.id.display = 'none';
        }
        else { // IE 4
            document.all.id.style.display = 'none';
        }
    }
}

function showdiv(id) {
    //safe function to show an element with a specified id

    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(id).style.display = 'block';
    }
    else {
        if (document.layers) { // Netscape 4
            document.id.display = 'block';
        }
        else { // IE 4
            document.all.id.style.display = 'block';
        }
    }
}

function openWindowX(url) {
    // Opens a new Window by the Client //
    var appwindow = null;
    appwindow = window.open(url, '_blank', 'status=1,scrollbars=1,toolbar=1,menubar=1,location=1,resizable=1');
    // Set Focus on the New Window //
    if (appwindow != null) {
        appwindow.focus();
    }
}

function EnableButton(id, State) {

    // Get SystemMessageBox //
    var me = document.getElementById(id);

    if (me) {
        if (State == 1) {
            //alert('Enabled');
            me.disabled = '';
        }
        else {
           //alert(me.disabled);
            me.disabled = 'disabled';
            //alert(me.disabled);
        }
    }
}


// Client Cookie support //
function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    }
    else var expires = "";
    document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') c = c.substring(1, c.length);
        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
    return null;
}

function eraseCookie(name) {
    createCookie(name, "", -1);
}
// Client Cookie support //
