/////////////////////////////LOCAL TIME
var currentTime = new Date();
var hour = currentTime.getHours();
var min = currentTime.getMinutes();
var sec = currentTime.getSeconds();
var clock = hour+":"+min+":"+sec;

var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();

var today_date = year+"-"+month+"-"+day;
var timestamp = today_date+" "+clock;
/////
var On=true;
var Off=false;
var st=Off;
var bk = Off;
var ch = Off;
var ft = Off;
var moreRev =false;
var openedEvent;
jQuery.noConflict();
/////
/////////////////////////////

function addDate(a){
document.getElementById(a).value=timestamp;
}

function FadeEffect(element){
                             new Effect.Fade(element, 
                                      { duration:1});
                                     }
function ShowEffect(element,limit){
                              new Effect.Appear(element, 
                                       {duration:1, from:0, to:limit});
                                        }
                                        
 function SlideMenu(element,limit){
                             new Effect.SlideDown(element, 
                                      { duration:limit});
                                     }
                                     
 function SlideHide(element,limit){
                             new Effect.SlideUp(element, 
                                      { duration:limit});
                                      }
                                      
function getPage(l){
    window.location = ("index.php?id="+l);
}                                      
 ////////////AUTO REFRESH
function autoLoad(urlLink, commentId) {
    ShowEffect(commentId, 1);

    new Ajax.Updater(commentId, urlLink, {
        method: 'get',
        });
    ShowEffect(commentId, 1);
    ShowEffect(commentId, 1);
    ShowEffect(commentId, 1);

}
///////////////////////SLIDE
function showSlide(){

autoLoad('processing/slide.php', 'slide_display');
    }
                              
                                                                                                                




///////////////////////


var pState = false;
var player='<embed width="204" height="20" type="application/x-shockwave-flash" src="public/flash/podcastplayer.swf" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" flashvars="song=http://streaming.visionsfm.com:8184/;stream.nsv&amp;nowPlaying= VisionsFm Radio">';
var playerOn = '<div onclick="stop()" id="player_btn">Stop Listening</div>';
var playerOff = '<div onclick="play()" id="player_btn">Listen Now</div>';


function play(){
 pState = true;
 document.getElementById("player").innerHTML = player;
 document.getElementById('welcome_btn').style.background = 'url(public/images/siteBg/stop_listening.png) no-repeat center top';
 document.getElementById('welcome_btn').innerHTML =playerOn;
}
 
function stop(){
 pState = true;
 document.getElementById("player").innerHTML = "";
 document.getElementById('welcome_btn').style.background = 'url(public/images/siteBg/listen_now.png) no-repeat center top';
 document.getElementById('welcome_btn').innerHTML =playerOff;
}

///////////////////


function shout(){

    addDate("date_created");
new Ajax.Updater( 'shout_box', 'processing/shoutbox.php', 
			                         { 
			                           method: 'post', 
			                           parameters: $('shout_form').serialize(),
			    
				                      }         );
				                       
				                       clearF('my_msg');

}
function shoutUpdate(){

new Ajax.Updater( 'shout_box', 'public/views/shoutbox.php?get_call', 
			                         { 
			                           method: 'get', 
			                           
			    
				                      });
                       }

function enter(evt)
		{
		if (!evt) var evt = window.event;
		var charCode = (evt.which) ? evt.which : window.event.keyCode; 
		 
		    if (charCode == 13) 
		    { 
			shout();
			} 
		
		}
function reviewNow(){
 addDate("datecreated");
new Ajax.Updater( 'reviews', 'processing/review.php', 
			                         { 
			                           method: 'post', 
			                           parameters: $('review_form').serialize(),
			    
				                      }         );
}
function clearF(f){
document.getElementById(f).value ='';

}
function vote(){
addDate("vote_date");
new Ajax.Updater( 'vote_response', 'processing/polls.php', 
			                         { 
			                           method: 'post', 
			                           parameters: $('zimnet_polls').serialize()
			    
				                      });
				                     
}


function showPage(p){
    
     autoLoad("public/views/main_content.php?id="+p+"&p","container_content");
    
     if(p == "Presenters"){
      document.getElementById('main_content').style.height="1000px";
      document.getElementById('container_content').style.height="1000px";
     }else if(p == "Schedule"){

      document.getElementById('main_content').style.height="1950px";
      document.getElementById('container_content').style.height="1650px";
     }else if(p == "About_us"){

      document.getElementById('main_content').style.height="900px";
      document.getElementById('container_content').style.height="900px";
     }else if(p == "News"){

      document.getElementById('main_content').style.height="1100px";
      document.getElementById('container_content').style.height="1100px";
     }else if(p == "Chat"){

      document.getElementById('main_content').style.height="500px";
      document.getElementById('container_content').style.height="500px";
     }else{

      document.getElementById('main_content').style.height="1200px";
      document.getElementById('container_content').style.height="1200px";
     }
}



function showDj(p){
     autoLoad("public/views/main_content.php?id=dj_profile&dj="+p+"&p","container_content");
     document.getElementById('main_content').style.background="#fff";
     document.getElementById('container_content').style.background="url(public/images/members/"+p+".jpg) no-repeat right bottom";
     document.getElementById('main_content').style.height="1250px";
     document.getElementById('container_content').style.height="1250px";
}


function showDjOnline(){
autoLoad("processing/dj_online.php","dj_online-pic"); 
}

function nowPlaying(){
autoLoad("processing/now_playing.php","now_playing"); 
}

function sendRequestNow(){ 
			new Ajax.Updater('response_vid', 'processing/contact_us.php', {
                 method: 'post',
                 parameters: $("bookings_form").serialize(),

                 });
			}
function upDateProfileNow(){ 
			new Ajax.Updater('response_vid', 'processing/update_profile.php', {
                 method: 'post',
                 parameters: $("update_form").serialize(),

                 });
			}			
function updateDj(p){
     autoLoad("public/views/main_content.php?id=dj_profile&dj="+p+"&p=1&update","container_content");
     document.getElementById('main_content').style.background="#fff";
     document.getElementById('container_content').style.background="url(public/images/members/"+p+".jpg) no-repeat right bottom";
     document.getElementById('container_content').style.height="700px";
     document.getElementById('main_content').style.height="700px";

}


function viewMore(a){
if(moreRev ===false){
moreRev =true;
document.getElementById('more_r').style.background="url(public/images/siteBg/lessBg.png) no-repeat center";
document.getElementById(a).style.background="url(public/images/siteBg/review_bg.png) no-repeat center bottom";
document.getElementById(a).style.position="absolute";
document.getElementById(a).style.top="-380px";
document.getElementById(a).style.width="370px";
document.getElementById(a).style.height="557px";
document.getElementById(a).style.padding="10px";

autoLoad("processing/all_reviews.php",a); 
}else{
moreRev = false;
document.getElementById(a).innerHTML="";
document.getElementById('more_r').style.background="url(public/images/siteBg/moreBg.png) no-repeat center";
document.getElementById(a).style.background="";
document.getElementById(a).style.position="";
document.getElementById(a).style.top="";
document.getElementById(a).style.width="";
document.getElementById(a).style.height="";
document.getElementById(a).style.padding="";
autoLoad("public/views/reviews.php?get_call",a);
}

}

function approvNow(a){
autoLoad("processing/approve_review.php?id="+a+"&status=approve","approveBtn"+a); 
}

function deleteReview(a){
autoLoad("processing/approve_review.php?id="+a,"approveBtn"+a); 
}

function shoDj(dj){
autoLoad('processing/dj.php?dj='+dj,'left_column');
autoLoad('processing/djs.php?dj='+dj,'column_280');
scrollTo(0,0);
                    }
                       
function showMoreOf(a){
var eV = "event_"+a;
var eVd = "event_span_desc"+a;
if(openedEvent ===a){
document.getElementById(eV).style.height="";
document.getElementById(eVd).style.height="";
openedEvent="";
}else{

document.getElementById(eV).style.height="100%";
document.getElementById(eVd).style.height="100%";
openedEvent=a;
}


}

function shoEvent(){
autoLoad('processing/events.php','left_column');
}
function shoHome(){

autoLoad('homePage.php','left_column');
//jQuery('#left_column').load('http://afrodeepradio.com/newsite/home.php');
}
function shoProgramme(){
autoLoad('public/views/programme.html','left_column');
}
function shoAbout(){
autoLoad('public/views/about_us.html','left_column');
}
function shoDjs(){
shoDj("DJ_Mninimuzi.png");
}

function sendTextToAS3(){
var Txt = document.getElementById('newSongSample').value;
var flash = document.getElementById("as3_js");
sendTextFromJS(Txt);
//document.getElementById('htmlText').value = "";
}

function closeFb(){
SlideHide("shout_box",1)
//document.getElementById("shout_box").style.display
}
