
//////////////Visibility Toggle Function////////////////////
        function toggle_visibility(id) {
        var e = document.getElementById(id);
        if(e.style.display == 'none')
        e.style.display = 'block';
        else
        e.style.display = 'none';
        }


///////////////////////////////////////////////////////////////

function setCookie(c_name,value,expiredays)
    {
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString() );
}

//////////////////////////////////////////////////////////////

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}
////////////////////////////////////////////////////////////////
function putid(uid)  {

var cid2 = uid;//<?php echo $GLOBALS['unitid'] ?>;     //get php variable

if(cid2=="") cid2="100724";        //if empty, fill with Alabama S U   <<<  Change if needed

var cid =parseInt(cid2);        //make interger

 var mc1 = getCookie('mc1');        //get all 4 ids
 var mc2 = getCookie('mc2');
 var mc3 = getCookie('mc3');
 var mc4 = getCookie('mc4');

     mc4=mc3;                //shift in new id and last id is lost
     mc3=mc2;
     mc2=mc1;
     mc1=cid;

     setCookie('mc1',mc1,365);        //put the 4 ids back  and done
     setCookie('mc2',mc2,365);
     setCookie('mc3',mc3,365);
     setCookie('mc4',mc4,365);

}

 /////////////////////////////////////////////////////////
function compurl() {

 var mc1 = getCookie('mc1');        //get the 4 ids
 var mc2 = getCookie('mc2');
 var mc3 = getCookie('mc3');
 var mc4 = getCookie('mc4');

if(mc1=="") mc1="100723";        //if empty, fill with Alabama S U   <<<  Change if needed
if(mc2=="") mc2="100724";        //if empty, fill with Alabama S U   <<<  Change if needed
if(mc3=="") mc3="100724";        //if empty, fill with Alabama S U   <<<  Change if needed
if(mc4=="") mc4="100724";        //if empty, fill with Alabama S U   <<<  Change if needed

// make string with url for comp page

    document.getElementById('curl').c1.value=mc1;
    document.getElementById('curl').c2.value=mc2;
    document.getElementById('curl').c3.value=mc3;
    document.getElementById('curl').c4.value=mc4;
}
////////////////////////////////////////////////////
function compurl2() {

 var mc1 = getCookie('mc1');        //get the 4 ids
 var mc2 = getCookie('mc2');
 var mc3 = getCookie('mc3');
 var mc4 = getCookie('mc4');

if(mc1=="") mc1="100724";        //if empty, fill with Alabama S U   <<<  Change if needed
if(mc2=="") mc2="100724";        //if empty, fill with Alabama S U   <<<  Change if needed
if(mc3=="") mc3="100724";        //if empty, fill with Alabama S U   <<<  Change if needed
if(mc4=="") mc4="100724";        //if empty, fill with Alabama S U   <<<  Change if needed

// make string with url for comp page

        var compurl2="/index.php?option=com_content&view=article&id=110&Itemid=127&c1=" + mc1 + "&c2=" + mc2 + "&c3=" + mc3 + "&c4=" + mc4  ;

    document.getElementById('curl2').href=compurl2;  // change the links url
}
