function displayFlash(src, width, height) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + width + '" height="' + height + '">');
	document.write('<param name="movie" value="' + src + '">');
	document.write('<param name="quality" value="high">');
	document.write('<embed src="' + src + '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" menu="0"></embed>');
	document.write('</object>');
}

function displayDirector(src, width, height) {
	document.write('<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0" width="' + width + '" height="' + height + '">');
	document.write('<param name="swRemote" value="swSaveEnabled=\'true\' swVolume=\'true\' swRestart=\'true\' swPausePlay=\'true\' swFastForward=\'true\' swContextMenu=\'true\'">');
	document.write('<param name="swStretchStyle" value="meet">');
	document.write('<param name="bgColor" value="#000000">');
	document.write('<param name="src" value="' + src + '">');
	document.write('<embed src="' + src + '" width="' + width + '" height="' + height + '" bgColor="#000000" swRemote="swSaveEnabled=\'true\' swVolume=\'true\' swRestart=\'true\' swPausePlay=\'true\' swFastForward=\'true\' swContextMenu=\'true\'" swStretchStyle="meet" type="application/x-director" pluginspage="http://www.macromedia.com/shockwave/download/"></embed>');
	document.write('</object>');
}

function displayIFrame(src, width, height) {
	document.write('<iframe src="' + src + '" height="' + height + '" width="' + width + '"></iframe>');
}

function displayWindow(src, thumb, title, width, height) {
	document.write('<table>');
	document.write('<tr>');
	document.write('<td align="right" width="190">');
	document.write('<a href="' + src + '" target="_blank"><img src="' + thumb + '" id="y8logo" height="135" width="180" /></a>');
	document.write('</td>');
	document.write('<td align="left" width="190">');
	document.write('<a href="' + src + '" target="_blank"><font size="4">Click here to play<br /><b>' + title + '</b></font></a>');
	document.write('</td>');
	document.write('</tr>');
	document.write('</table>');
}

function displayFlashVars(src, width, height, flashvars) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + width + '" height="' + height + '">');
	document.write('<param name="movie" value="' + src + '">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="flashVars" value="' + flashvars + '">');
	document.write('<embed src="' + src + '" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" menu="0" flashVars="' + flashvars + '"></embed>');
	document.write('</object>');
	// document.write('<SCR'+'IPT
	// src="http://rts.pgmediaserve.com/pp/fbf1b261/?pid=30030&t=24&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new
	// Date().getTime()+'" language="JavaScript"
	// type="text/javascript"></SCR'+'IPT>');
}

function preLoadPicture(pic) {
	heavyImage = new Image(); 
	heavyImage.src = CurUrl + pic + ".jpg";

}

// 2 5 8 11 14 17 20 23 26 29
// setTimeout("immobile_100()",3000);

var OriPicNum = 0;
var CurDocument = 0;
var CurPicNum = 0;
var CurUrl = "";

function getNextThumbNum(CurNum) {
	thumbs = new Array(2,5,8,11,14,17,20,23,26,29);
	for (i = 0; i < thumbs.length; i++) {
		if (thumbs[i] > CurNum) {
			return thumbs[i];
		}
	}
	return thumbs[0];
}

function nextThumbnail(idDoc) {
	if (CurDocument != 0 && idDoc == CurDocument) {
		// alert("CurPicNum : " + CurPicNum + " CurDocument : " + CurDocument);
		// alert(document.getElementById("pic_" + CurDocument));
		document.getElementById("pic_" + CurDocument).src = CurUrl + CurPicNum + ".jpg";
		nextthumb = getNextThumbNum(CurPicNum);
		preLoadPicture(nextthumb);
		CurPicNum = nextthumb;
		setTimeout("nextThumbnail("+ CurDocument +")", 1000);
	}
}

function stopThumbSlide() {
	TmpDoc = CurDocument;
	CurDocument = 0;
	document.getElementById("pic_" + TmpDoc).src = CurUrl + OriPicNum + ".jpg";	
}

function startThumbSlide(IdDoc, CurNum, Url) {
	if (CurDocument == 0) {
		OriPicNum = CurNum;
		CurDocument = IdDoc;
		CurUrl = Url;
		nextthumb = getNextThumbNum(CurNum);
		preLoadPicture(nextthumb);
		CurPicNum = nextthumb;
		setTimeout("nextThumbnail("+ CurDocument +")", 20);
	}
}

function thumbcastDisplayRandomThumb(content) {
	var thumb = Math.floor((Math.random() * 600)) % 30 + 1;
	content = content.replace(/\.[0-9]+.jpg/, "." + thumb + ".jpg");
	// content = content.replace(/video[0-9]+\/0\//, "/" + thumb + "/");
	content = content.replace(/THUMBNUM/g, thumb);
	document.write(content);
	
}

function Set_Cookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	
	var expires_date = new Date( today.getTime() + (expires) );
	
	var toset = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" )
	document.cookie = toset;
	
}
