function showVideo( video_file, image_file, video_name, size )
{
	if ( document.getElementById( 'video_name' ) )
		document.getElementById( 'video_name' ).innerHTML = video_name;
	
	_FlashRunFunc('videoplayer', 'vidStop');
	_FlashRunFunc('videoplayer', 'loadPic', image_file);
	_FlashRunFunc('videoplayer', 'loadURL', video_file + '.flv');
	
	if (size)
		document.getElementById('file_size').innerHTML = size;
		
	$("#download_url").attr("href", video_file + ".avi");
}

var timer_count = 0;


function _FlashRunFunc(flash_id, func, param)
{
	var player = __getFlash( flash_id );
	if(jQuery.isFunction(player[func]) || timer_count > 10)
	{
		player[func](param);
		timer_count = 0;
	}
	else
	{
		timer_count++;
		setTimeout( function(){
			_FlashRunFunc(flash_id, func, param);
			}, 500);
	}
}


function __getFlash ( movieName ) {
	if (window.document[movieName]) 
        return window.document[movieName];
	else if( document.embeds && document.embeds[movieName] )
        return document.embeds[movieName]; 
	else 
	    return document.getElementById(movieName);
}

function mySubmit(poll, items)
{
	for( i = 0; i < items.length; i++ ){
		if( items[ i ].checked ){
			getContent( 'ajax/vote.html' , 'vote=' + items[ i ].value + '&poll_id=' + poll,'',  'vote_block_' + poll );
		}
	}				
}


function getDocumentHeight(){
    return (document.documentElement.scrollHeight > document.body.offsetHeight)?document.documentElement.scrollHeight:document.body.offsetHeight;
}	

function getDocumentWidth(){
    return (document.body.scrollWidth > document.body.offsetWidth)?document.body.scrollWidth:document.body.offsetWidth;
}

function getBodyScrollTop(){
    return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}
function getClientWidth()
{
    return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function change_caphca_image (id)
{
	setTimeout("capcha('" + id + "')", 100);
}

function capcha(id)
{
	document.getElementById(id).src = '/index/imagecode.html?rnd='+Math.random();	
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function SetCookie(cookieName,cookieValue,nDays) {
	 var today = new Date();
	 var expire = new Date();
	 if (nDays==null || nDays==0) nDays=1;
	 expire.setTime(today.getTime() + 3600000*24*nDays);
	 document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString();
}
