var rippleShowing=false;
var contestShowing=false;

function embedPageIFrame(source)
{
	document.write( '<iframe name="content" src="' + source + '" width="100%" height="100%" scrolling="auto" frameborder="none"></iframe> ' );
}

function embedFlashObject(asset, height, width, color, xmlPath, stylesPath)
	{
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
		document.write('height="' + height + '"');
		document.write('width="' + width + '">');
		document.write('<param name="src" value="' + asset + '">');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<param name="FlashVars" value="xmlPath=' + xmlPath + '&stylesPath=' + stylesPath + '" />');
		document.write('<param name="align" value="middle">');
		document.write('<param name="quality" value="high">');
		document.write('<param name="bgcolor" value="' + color + '">');
		document.write( '<embed ' );
		document.write( '  src="' + asset + '" ' );
		document.write( '  name="' + name + '"' );
		document.write( '  height="' + height + '" ' );
		document.write( '  width="' + width + '" ' );
		document.write( '  align="middle" ' );
		document.write( '  quality="high" ' );
		document.write( '  allowScriptAccess="sameDomain" ' );
		document.write( '  FlashVars="xmlPath=' + xmlPath + '&stylesPath=' + stylesPath + '"');
		document.write( '  scale="aspect" ' );
		document.write( '  pluginspage="http://www.macromedia.com/go/getflashplayer" ' );
		document.write( '  bgcolor="' + color + '" ' );
		document.write( '  type="application/x-shockwave-flash">' );
		document.write( '</embed>' );
		document.write('</object>');
	}

function showForm() {
	// show ripple form
	rippleShowing=true;
	document.getElementById("rippleForm").style.display="inline";

	hideFlash();
	
	// place form on top of rippleForm
	var getForm=document.getElementById("formContainer");

	getForm.style.visibility="visible";
	getForm.style.position="absolute";
	getForm.style.top="60px";
	getForm.style.left="170px";
	getForm.style.zIndex="500";
}

function hideFlash() {
	// hide flash objects
	var getObjects=document.getElementsByTagName("OBJECT");
	for (i=0; i<getObjects.length; i++) {
		getObjects[i].style.visibility="hidden";
		//getObjects[i].style.display="none";
	}
	var getEmbeds=document.getElementsByTagName("EMBED");
	for(j=0;j<getEmbeds.length;j++) {
		getObjects[j].style.visibility="hidden";
		//getObjects[j].style.display="none";
	}
	document.getElementById("counterHolder").style.visibility="hidden";
}

function showFlash() {
	// hide flash objects
	var getObjects=document.getElementsByTagName("OBJECT");
	for (i=0; i<getObjects.length; i++) {
		getObjects[i].style.visibility="visible";
		//getObjects[i].style.display="inline";
	}
	var getEmbeds=document.getElementsByTagName("EMBED");
	for(j=0;j<getEmbeds.length;j++) {
		getObjects[j].style.visibility="visible";
		//getObjects[j].style.display="inline";
	}
	document.getElementById("counterHolder").style.visibility="visible";
}

function showFrame() {
	if (!contestShowing) {
		rippleShowing=true;
		var getContainer=document.getElementById("frameContainer");
		getContainer.style.display="inline";
		hideFlash();
	}
}

function closeFrame() {
	rippleShowing=false;
	var getContainer=document.getElementById("frameContainer");
	getContainer.style.display="none";
	showFlash();
}

function embedFlashCounter(asset, width, height, countrecord) {
	var flashHtml="";
	flashHtml+= '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
		flashHtml+='height="' + height + '"';
		flashHtml+='width="' + width + '">';
		flashHtml+='<param name="src" value="' + asset + '">';
		flashHtml+='<param name="allowScriptAccess" value="sameDomain" />';
		flashHtml+='<param name="FlashVars" value="count=' + countrecord+'"';
		flashHtml+='<param name="align" value="middle">';
		flashHtml+='<param name="quality" value="high">';
		flashHtml+='<param name="bgcolor" value="#FFFFFF">';
		flashHtml+= '<embed ' ;
		flashHtml+= '  src="' + asset + '" ' ;
		flashHtml+= '  name="' + asset + '"' ;
		flashHtml+= '  height="' + height + '" ' ;
		flashHtml+= '  width="' + width + '" ';
		flashHtml+= '  align="middle" ' ;
		flashHtml+= '  quality="high" ' ;
		flashHtml+= '  allowScriptAccess="sameDomain" ' ;
		flashHtml+= '  FlashVars="count=' + countrecord + '"';
		flashHtml+= '  scale="aspect" ' ;
		flashHtml+= '  pluginspage="http://www.macromedia.com/go/getflashplayer" ' ;
		flashHtml+= '  bgcolor="#FFFFFF" ';
		flashHtml+= '  type="application/x-shockwave-flash">';
		flashHtml+= '</embed>';
		flashHtml+= '</object>';
		
		document.getElementById("counterHolder").innerHTML=flashHtml;
}
