// JavaScript Document

var BoxVideo=new Array();
function Start(){
	var divs =document.getElementsByTagName("a");
	for(var a=0;a<divs.length;a++){
		if(divs[a].rel=="flv_player" ||divs[a].rel=="flv_player_autoplay"){
			BoxVideo.push(divs[a]);
			var width;
			var height;
			var title;
			var filename="swf/flv_player.swf";
			var color;
			
			
			title=divs[a].title;
			if(title){
				
			}else{
				title="";	
			}
			
			var autoplay;
			if(divs[a].rel=="flv_player"){
				autoplay="false";	
				
			}else if(divs[a].rel=="flv_player_autoplay"){
				autoplay="true";			 
			}
			width=divs[a].style.width;
			height=divs[a].style.height;
			
			if(!width||width==""){
				width=600;
			}
			if(!height||height==""){
				height=400;
			}
			color=divs[a].style.color;
			if(!color){
				color="#ffffff";	
			}else{
				color=rgbConvert(color);
			}
			
			
			//var color=#cccccc;
		//	var color=divs[a].style.color;
			
			var src=divs[a].href;
			divs[a].innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'"><param name="allowfullscreen" value="true" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /><param name="movie" value="'+filename+'" /><param name="FlashVars" value="URL='+src+'&width='+width+'&height='+height+'&autoplay='+autoplay+'&color='+color+'"><embed src="'+filename+'" FlashVars="URL='+src+'&width='+width+'&height='+height+'&autoplay='+autoplay+'&color='+color+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" wmode="transparent" width="'+width+'" height="'+height+'"></embed></object>';
		}
	}

	
}
function rgbConvert(str) {
   str = str.replace(/rgb\(|\)/g, "").split(",");
   str[0] = parseInt(str[0], 10).toString(16).toLowerCase();
   str[1] = parseInt(str[1], 10).toString(16).toLowerCase();
   str[2] = parseInt(str[2], 10).toString(16).toLowerCase();
   str[0] = (str[0].length == 1) ? '0' + str[0] : str[0];
   str[1] = (str[1].length == 1) ? '0' + str[1] : str[1];
   str[2] = (str[2].length == 1) ? '0' + str[2] : str[2];
   return ('#' + str.join(""));
}
window.onload=Start;
