   /* Developer: priyanka@votigo.com                                                              */

   /* This function is written for the contest details page. It can be extended to other pages    */
   /* as well. It primarily clears the className that is applied by jquery to the highlighted tag */
   /* so that the overlay shows up above the tab                                                  */

  function J$(eleID){ return document.getElementById(eleID);}

   function cleartabs () {
     if(document.getElementById("detul")) {
       for (var i = 1; i < 4; i++) {
         a = "frag"+i;
         if(document.getElementById(a).className == "ui-tabs-selected") {document.getElementById(a).className = "temp-tab";}
       }
     }
   }
   /* This function is written for the contest details page. It can be extended to other pages    */
   /* as well. It resumes the className that was applied using cleartabs                          */
   function resumetabs () {
     if(J$("detul")) {
       for (var i = 1; i < 4; i++) {
         a = "frag"+i;
         if(J$(a).className == "temp-tab") {J$(a).className = "ui-tabs-selected";}
       }
     }
   }
   /* itunes box display   */
    function showitunes(state) {
      J$('itunessec').style.display = state;
    }
    /* transpcript box display   */
    function showtranscript(state) {
      J$('transcript').style.display = state;
    }

   /* kara box display   */
    function showkaraol(state) {
      J$('karastoryHolder').style.display = state;
      if(state == "block") {cleartabs();}
      if(state == "none") {resumetabs();}
    }

   /* toolkittabs   */
    function contrecord(step) {
      if (step == "1") {
        J$('prepare').style.display = "none";
        J$('uploadtxt').style.display = "none";
        J$('record').style.display = "block";
        J$('frag3-lfttab').className = "classtk2";
      }
      if (step == "2") {
        J$('prepare').style.display = "none";
        J$('record').style.display = "none";
        J$('uploadtxt').style.display = "block";
        J$('frag3-lfttab').className = "classtk3";
      }
    }

   /* Calls the login overlay used across the site */
   function callLoginOverlay() {
     if(document.getElementById) {
       J$('rulesHolder').src = "/users/login";
       computeLoginPosition('rulesHolder');
       cleartabs();
       prepareOverlay('showRules', iframefromLeft, '0', '');
     }
   }

  function showtip(id) {
    J$(id).style.display = "block";
    if(id == "tipbox1") {
      J$('EntrantfieldField3Month').style.visibility = 'hidden';
      J$('EntrantfieldField3Day').style.visibility = 'hidden';
      J$('EntrantfieldField3Year').style.visibility = 'hidden';
    }
    if(id == "tipbox2") {
      J$('EntrantfieldField6Month').style.visibility = 'hidden';
      J$('EntrantfieldField6Day').style.visibility = 'hidden';
      J$('EntrantfieldField6Year').style.visibility = 'hidden';
    }
  }
  function hidetip(id) {
    J$(id).style.display = "none";
    if(id == "tipbox1") {
      J$('EntrantfieldField3Month').style.visibility = 'visible';
      J$('EntrantfieldField3Day').style.visibility = 'visible';
      J$('EntrantfieldField3Year').style.visibility = 'visible';
    }
    if(id == "tipbox2") {
      J$('EntrantfieldField6Month').style.visibility = 'visible';
      J$('EntrantfieldField6Day').style.visibility = 'visible';
      J$('EntrantfieldField6Year').style.visibility = 'visible';
    }
  }

  function timermover(state) {
    if(state == "over") {
      J$('sectmr').style.backgroundImage="url('/img/folgers/tickerbg1-over.jpg')";
      J$('timer').style.color = "#D2AB5A";
    }
    if(state == "out") {
      J$('sectmr').style.backgroundImage="url('/img/folgers/tickerbg1.jpg')";
      J$('timer').style.color = "#D8C8B9";
    }
  }

   /* adobe box display */
    function showpdf(state, pdfname, top, left) {
    //alert(pdfname);
      J$('adobebox').style.display = state;
      if(top != null) {J$("adobebox").style.top = top+"px";}
      if(left != null) {J$("adobebox").style.left = left+"px";}
      if(pdfname != null) {J$("mypdflink").innerHTML  = "<a href='/pdf/" +pdfname+ ".pdf' onclick='displaypdfandclose();' target='_blank'>click here</a>";}
    }

    function displaypdfandclose() {
     J$('adobebox').style.display = "none";
    }
