function writeFlashObject(html){
	//flash url
	var regex = /src=(['"]).*?\1/gi;
	if( regex.test(html) ){
    	var fileSrc = html.match(regex) + " ";
    	regex = /['"]/;
    	var fileArray = fileSrc.split(fileSrc.match(regex));
    	var file = fileArray[1];
    	//youtube extra option
    	file = file.replace(/&rel=1/, '');
    	regexYT=/^http\:\/\/www\.youtube\.com\/v\/[a-z0-9\-_]+/gi;//simple youtube clip
    	regexDM=/^http\:\/\/www\.dailymotion\.com\/swf\/([a-z0-9\-_]+)/gi;//simple dailymotion clip
    	if(regexYT.test(file)){
    		file = file.match(regexYT);
    		file += '&rel=0&color1=0xe1600f&color2=0xfebd01&border=0&autoplay=1';
    	}
    	else if(regexDM.test(file)){
    		var file = file.match(regexDM);
    		file += '&v3=1&colors=background:FF9600;glow:FFFFFF;foreground:333333;special:FFC300;&autoPlay=1&related=0';
    	}
    	var flashObj = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="425" height="350" id="flash" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="true" /><param name="movie" value="' + file + '" /><param name="quality" value="high" /><embed src="' + file+ '" quality="high" width="425" height="350" name="flash" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
    }
    //simple file
    else{
        var file=html;
        var flashObj = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="640" height="480" id="flash" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="true" /><param name="movie" value="' + file + '" /><param name="quality" value="high" /><embed src="' + file+ '" quality="high" width="640" height="480" name="flash" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
	}

	


	if(document.getElementById('flashObject')){
		document.getElementById('flashObject').innerHTML = flashObj;
	}
	else {
		alert("Invalid flash object id");
	}
}


function dateChanged(calendar) {
    // Beware that this function is called even if the end-user only
    // changed the month/year.  In order to determine if a date was
    // clicked you can use the dateClicked property of the calendar:
    if (calendar.dateClicked) {
        // OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
        var y = calendar.date.getFullYear();
        var m = calendar.date.getMonth();     // integer, 0..11
        var d = calendar.date.getDate();      // integer, 1..31
        // redirect...
        m=m+1;
        if(m<10) m = '0' + m;
        if(d<10) d = '0' + d;
        window.location = "/" + y + "-" + m + "-" + d + "/";
    }
}