
var toggeld = false;
var toggeld2 = false;
function toggle(toggleId, e){

    var body = document.getElementById(toggleId);

    var im = toggleId + "_toggle";
    if (body.style.display == 'none') {
        body.style.display = 'block';
    } else {
        body.style.display = 'none';
    }

    if (e) {
        e.cancelBubble = true;
        if (e.stopPropagation) {
            e.stopPropagation();
        }
    }
}


// check if all checkboxes are unchecked
function allItinsUnchecked(){
    var itins = document.getElementsByName('itins[]');
    unChecked = true;
    // internet explorer shit
    if(document.all){
        var num = 0;
        var dataSet = itins[num];
        while(typeof dataSet == 'object'){
            if(dataSet.checked == true) unChecked = false;
            num++;
            dataSet = itins[num];
        }
    // rest of the world
    } else {
        for(id in itins){
            if(typeof itins[id] == 'object'){
                if(itins[id].checked == true) unChecked = false;
            }
        }
    }
    return unChecked;
}

function toggle2(toggleId2, e){

    var body = document.getElementById(toggleId2);

    var im = toggleId2 + "_toggle";
    if (body.style.display == 'none') {
        body.style.display = 'block';
    } else {
        body.style.display = 'none';
    }

    if (e) {
        e.cancelBubble = true;
        if (e.stopPropagation) {
            e.stopPropagation();
        }
    }
}
function allItinsUnchecked2(){
    var itins = document.getElementsByName('itins[]');
    unChecked = true;
    // internet explorer shit
    if(document.all){
        var num = 0;
        var dataSet = itins[num];
        while(typeof dataSet == 'object'){
            if(dataSet.checked == true) unChecked = false;
            num++;
            dataSet = itins[num];
        }
    // rest of the world
    } else {
        for(id in itins){
            if(typeof itins[id] == 'object'){
                if(itins[id].checked == true) unChecked = false;
            }
        }
    }
    return unChecked;
}

function toggleonewyclose(toggleId, e){

    var body = document.getElementById(toggleId);

    var im = toggleId + "_toggle";
    if (body.style.display == 'none') {
    } else {
        body.style.display = 'none';
    }

    if (e) {
        e.cancelBubble = true;
        if (e.stopPropagation) {
            e.stopPropagation();
        }
    }
}

function toggleonewyopen(toggleId2, e){

    var body = document.getElementById(toggleId2);

    var im = toggleId2 + "_toggle";
    if (body.style.display == 'block') {
    } else {
        body.style.display = 'block';
    }

    if (e) {
        e.cancelBubble = true;
        if (e.stopPropagation) {
            e.stopPropagation();
        }
    }
}

function MM_findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { 
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
