function showDL() {
       if(document.getElementById("prompt_dl").style.display == "none") {
       		document.getElementById("prompt_dl").style.display = "block";
          document.getElementById("prompt_enter").style.display = "none";
       }
    }
       
       function showEnter(checkShowing) {
       if(document.getElementById("prompt_dl").style.display == "block") {
       		document.getElementById("prompt_dl").style.display = "none";
          document.getElementById("prompt_enter").style.display = "block";

       }
    }
       
       

function startclock(dnow, weekly, startHour, startMinute, endHour, endMinute, checkShowing, startHour2, startMinute2, endHour2, endMinute2) {
        
    if((dnow.getDay() == weekly) || (weekly < 0 && dnow.getDay() >=1 && dnow.getDay() <=5)) {
                
        if(checkShowing <= 1) {
                                
            if((dnow.getHours() >= startHour) && (dnow.getMinutes() >= startMinute)) {
                if((dnow.getHours() >= endHour) && (dnow.getMinutes() >= endMinute)){
                    showDL();
                    if(checkShowing > 0) {
                        checkShowing = 2  
                    }
                } else {
                    showEnter();
                }
            } else {
                showDL();    
            }
        }
        
        if(checkShowing == 2) {
           if((dnow.getHours() >= startHour2) && (dnow.getMinutes() >= startMinute2)) {
                if((dnow.getHours() >= endHour2) && (dnow.getMinutes() >= endMinute2)){
                    showDL();
                } else {
                    showEnter();
                }
            } else {
                showDL();
            } 
        }
    
    }

    
   /* var nhours=dnow.getHours();
    var nmins=dnow.getMinutes();
    var nsecn=dnow.getSeconds();
    var AorP=" ";
    
    if (nhours>=12)
        AorP="P.M.";
    else
        AorP="A.M.";
    
    if (nhours>=13)
        nhours-=12;
    
    if (nhours==0)
     nhours=12;
    
    if (nsecn<10)
     nsecn="0"+nsecn;
    
    if (nmins<10)
     nmins="0"+nmins;
     
    var DisplayStr = nhours + ":" + nmins + ":" + nsecn + " " + AorP;
    
    document.getElementById("cntdwn").innerHTML = DisplayStr;*/
        
    var timePast = Date.UTC(dnow.getFullYear(),dnow.getMonth(),dnow.getDate(),dnow.getHours(),dnow.getMinutes(),dnow.getSeconds()) + 14400000;
              
    dnow.setTime(timePast + 1000);
        
    setTimeout("startclock(dnow, weekly, startHour, startMinute, endHour, endMinute, checkShowing, startHour2, startMinute2, endHour2, endMinute2)",1000);

}

function putspan() {
//    document.write("<span id='cntdwn'></span>");
    document.write('<div id="prompt_enter" style="display:none;"><a href="javascript:launchGroup(1029354185);" class="enter_room">Enter Room &raquo;</a></div>');
	document.write('<div id="prompt_dl" style="display:block;"><strong>While you\'re waiting why not check out the hundreds of other rooms on PaltalkScene...</strong><a href="http://www.paltalk.com/download/0.x/pal_install_r17709.exe" id="dlu1" class="dowload_button"><img src="http://blog.paltalk.com/paltalkshows/images/scene_images/icon_download.gif" />Download PaltalkScene</a><a href="http://www.paltalk.com/en/learnaboutpaltalk.shtml" class="learn_more">learn more &raquo;</a></div>');
}


putspan();

if(onTwice) {
    var checkShowing = 1;
} else {
    var checkShowing = -1;
}
startclock(dnow, weekly, startHour, startMinute, endHour, endMinute, checkShowing, startHour2, startMinute2, endHour2, endMinute2);
