﻿// JavaScript Document
function insertFlash(Flash,Width,Height){
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ");
	document.write("codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" ");
	document.write("width=\"" + Width + "\" height=\"" + Height + "\">");
	document.write("<param name=\"movie\" value=\"" + Flash + "\">");
	document.write("<param name=\"quality\" value=\"high\">");
	document.write("<param name=\"wmode\" value=\"transparent\">");
	document.write("<embed wmode='transparent' src=\"" + Flash + "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" ");
	document.write("type=\"application/x-shockwave-flash\" width=\"" + Width + "\" height=\"" + Height + "\"></embed>");
	document.write("</object>");
}



var speed=4000;
var aspeed=2000;
var htotal=0;
var scrollNum=2;
var thumbinternal;


$(function() {
	$("#demo li").each(function(){
		htotal+=$(this).height();
	})
	$("#demo ul").css("height",htotal);
	
	thumbinternal=setInterval(function() { go(); }, speed);
	
	$("#demo").hover(function(){
							     clearInterval(thumbinternal);
							  },function(){
								  thumbinternal=setInterval(function() { go(); }, speed);
							   })
})



function go()
{
	var h=0;
	for(i=0 ;i< scrollNum; i++)
	{
		var obj=$('#demo li').eq(i);
		//alert(obj.html());
		h +=obj.height()+15;
		$("#demo ul").append(obj.clone());
		
	}
	$("#demo ul").animate( {top: -h}, aspeed,function(){ removeto(scrollNum) });
	
}

function removeto(obj){
	for(i=0 ;i< scrollNum; i++)
	{
		var obj=$('#demo li').eq(0);
		//alert(obj.html());
		obj.remove();
	}
	$("#demo ul").css("top",0);
}



