<?php



/*
  ============================================================
   Countdown-Plugin
  ============================================================
    Version:    v1.1
    Released:   8. may 2012
    Copyright:  Jens Maegaard - "cmsimple-xh.dk jmnet.dk"
    Email:      info@jmnet.dk
    Website:    www.cmsimple-xh.dk - jmnet.dk
  ============================================================
*/



if (!defined('CMSIMPLE_XH_VERSION')) {
    header('HTTP/1.0 403 Forbidden');
    exit;
}


function countdown_values() {
    global $plugin_cf;
    static $values = array('event', 'event_date');
	}
	
function countdown() {
    global $hjs, $pth, $plugin_cf, $plugin_tx;	
	 $pcf = $plugin_cf['countdown'];
     $ptx = $plugin_tx['countdown'];


$o .= '<div id="cd"><div id="heading"><h4>'.$ptx['countdown_heading'].'</h4></div>
<script>
var before="'.$ptx['countdown_eventname'].'"
var current= "'.$ptx['countdown_end'].'"
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

function countdown(yr,m,d){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var futurestring=montharray[m-1]+" "+d+", "+yr
var difference=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1)
if (difference<=0)
document.write(current)
else if (difference>0)

document.write("'.$ptx['countdown_only'].'"+difference+" '.$ptx['countdown_days'].' "+before+"'.$ptx['countdown_to'].'")
}
countdown('.$pcf['event_date'].')
</script> <div id="creater">Powered by <a href="http://www.jmnet.dk">JmNet.dk</a></div></div>'
; 
return $o;

}


?>
