function OnImgUpdate( iProgress )
{   
	 if( (iProgress >= 1) && (iProgress <= 10) && (iProgress > g_iStep) )
	 {   
			 g_iStep++;
			 var oSpan = document.getElementById( "sDot" + iProgress + "" );
			 oSpan.className = 'FullDot';
	 }
}

function OnCompletion()
{ 	
	$('loading').style.display="none"; 
	$('pagewrapper').style.visibility="visible";
	// alert('images loaded');
}

function StartPreload()
{
	 var szImages = new Array( "../images/advertisement.jpg", "../style/images/boxes.png", "../style/images/moyo-studios.png", "../style/images/check.jpg", "../style/images/store1.jpg", "../style/images/store5.jpg", "../style/images/video1.jpg", "../style/images/video2.jpg", "../style/images/contact.jpg", "../style/images/store3.jpg", "../style/images/store4.jpg", "../style/images/store6.jpg", "../style/images/check_pattern.jpg" );

	 // Execute Image Preloader
	 var oPreload = new ImagePreload( szImages, OnImgUpdate, OnCompletion );
}

function getContent (page) {																
	var url = page+'.htm';
	var myAjax = new Ajax.Updater( 'firstpage', url, {method: 'get',onComplete: startSlide()} );							
}

function getNewsContent (page) {																
	var url = page+'.htm';
	var myAjax = new Ajax.Updater( 'news_content', url, {method: 'get'} );							
}

function startGallery() {	
	var forunway = new FlashObject("gallery_emmy.swf", "emmy_gallery", "474", "352", "0");
	forunway.addParam("wmode", "transparent");
	forunway.addVariable("xmlPath","gallerysettings.php");
	forunway.write("news_content");							
}

function startSlide() {
	start_slideshow(1, 3, 4000);
}

function openForm() {
	$('form').style.display='block';
	$('inquire').style.display='none';
	$('submit').style.display='block';
}
function closeForm() {
	$('form').style.display='none';
	$('inquire').style.display='block';
	$('submit').style.display='none';
}

function clearText(id) {				
	if (textClicked == false){ 
		id.value=""; 
		id.style.color="#000";
		textClicked=true; 
	} 
}	

function playCommercial(index) {
	pagesObj.moveTo(1);
	getContent(index, 'firstpage',true);
}

function showGallery(condition) {
	if (condition) condition='block';
	else condition='none';
	$('gallery').style.display=condition;
	$('arrows').style.display=condition;
}	
