var x=600;
var level=1;
var trial=1;
var number_to_analyze=Math.floor(Math.random()*900+199);

var obj=new Array(100);
var trial=1;
var mousex=0, mousey=0;
var ready_for_a_new_trial="false";
var number_to_extract_temp=100;
var sentence1="";
var str1=" ";
var trialminus1=0;
var number_animation_time_counter=0;
var number_animation_time_counter_active="false";
var wrong_achadot="false";
var wrong_achadot_timer=0;
var wrong_asarot="false";
var wrong_asarot_timer=0;
var wrong_meot="false";
var wrong_meot_timer=0;
var lasttemprand=8;
var delay=15;

var is_msie=navigator.userAgent.toLowerCase().indexOf('msie')>-1;
var is_firefox=navigator.userAgent.toLowerCase().indexOf('firefox')>-1;
var is_chrome=navigator.userAgent.toLowerCase().indexOf('chrome')>-1;



var pic=new Array(30);


	pic[0]= new Image(36,69); pic[0].src="../images/numbers_set_1/0_clr_e0.gif"; 
	pic[1]= new Image(36,69); pic[1].src="../images/numbers_set_1/1_clr_e0.gif"; 
	pic[2]= new Image(36,69); pic[2].src="../images/numbers_set_1/2_clr_e0.gif"; 
	pic[3]= new Image(36,69); pic[3].src="../images/numbers_set_1/3_clr_e0.gif"; 
	pic[4]= new Image(36,69); pic[4].src="../images/numbers_set_1/4_clr_e0.gif"; 
	pic[5]= new Image(36,69); pic[5].src="../images/numbers_set_1/5_clr_e0.gif"; 
	pic[6]= new Image(36,69); pic[6].src="../images/numbers_set_1/6_clr_e0.gif"; 
	pic[7]= new Image(36,69); pic[7].src="../images/numbers_set_1/7_clr_e0.gif"; 
	pic[8]= new Image(36,69); pic[8].src="../images/numbers_set_1/8_clr_e0.gif"; 
	pic[9]= new Image(36,69); pic[9].src="../images/numbers_set_1/9_clr_e0.gif"; 
							  
	pic[10]= new Image(36,69); pic[10].src="../images/numbers_set_1/0_clr_e0_first.gif"; 
	pic[11]= new Image(36,69); pic[11].src="../images/numbers_set_1/1_clr_e0_first.gif"; 
	pic[12]= new Image(36,69); pic[12].src="../images/numbers_set_1/2_clr_e0_first.gif"; 
	pic[13]= new Image(36,69); pic[13].src="../images/numbers_set_1/3_clr_e0_first.gif"; 
	pic[14]= new Image(36,69); pic[14].src="../images/numbers_set_1/4_clr_e0_first.gif"; 
	pic[15]= new Image(36,69); pic[15].src="../images/numbers_set_1/5_clr_e0_first.gif"; 
	pic[16]= new Image(36,69); pic[16].src="../images/numbers_set_1/6_clr_e0_first.gif"; 
	pic[17]= new Image(36,69); pic[17].src="../images/numbers_set_1/7_clr_e0_first.gif"; 
	pic[18]= new Image(36,69); pic[18].src="../images/numbers_set_1/8_clr_e0_first.gif"; 
	pic[19]= new Image(36,69); pic[19].src="../images/numbers_set_1/9_clr_e0_first.gif";


   	pic[22]= new Image(120,5); pic[22].src="../themes/sea/duck_swimming_left1.gif";
	pic[23]= new Image(1022,620); pic[23].src="../themes/sea/background-sea1.jpg"; 


var aySound = new Array();
	aySound[0]=new Image(); if(is_msie){aySound[0].src = "../sounds/DingLing.wav";} else {aySound[0].src = "../sounds/DingLing.mp3";}
	aySound[1]=new Image(); if(is_msie){aySound[1].src = "../sounds/Buzz01.wav";} else {aySound[1].src = "../sounds/Buzz01.mp3";}


function set_width_of_screen(){

		//Get Window Width

		if (parseInt(navigator.appVersion)>3) {
		 if (navigator.appName=="Netscape") {
		  winW = window.innerWidth;
		  winH = window.innerHeight;
		 }
		 if (navigator.appName.indexOf("Microsoft")!=-1) {
		  winW = document.body.offsetWidth;
		  winH = document.body.offsetHeight;
		 }
		}

		var ad_left_limit=860;
		var ad_right_limit=1025;
		var ads_width=160;
		var str_ad="";
		winW-=5;

		if(winW<=1200){	str_ad="div_ad_vertical"; ads_width=160;} else {str_ad="div_ad_big"; ads_width=336;}

			if(winW<ad_left_limit+ads_width){document.getElementById(str_ad).style.left=ad_left_limit}  //setting the left limit of the ad location
			else {document.getElementById(str_ad).style.left=winW-ads_width;}  

			if(winW>ad_right_limit+ads_width) {document.getElementById(str_ad).style.left=ad_right_limit;} //setting the right limit of the ad location
		

		document.getElementById(str_ad).style.visibility="visible";
		document.getElementById(str_ad).style.display="";

}


var wait_timer=100;
var wait_timer_kivun=-1;

function wait_for_images_to_load(){

	if(pic[23].complete){
		document.getElementById("div_pleasewait").style.visibility="hidden";
		init_main();
	}	else {	
			document.getElementById("div_pleasewait").style.visibility="visible";
			document.getElementById("div_btnrunfirsttime").style.visibility="hidden";
			document.getElementById("div_pleasewait").style.filter = 'alpha(opacity=' + wait_timer + ')';
			document.getElementById("div_pleasewait").style.opacity=wait_timer/100;
		
			wait_timer+=wait_timer_kivun;
			if(wait_timer<=1){wait_timer_kivun=1}
			if(wait_timer>=100){wait_timer_kivun=-1}
			setTimeout('wait_for_images_to_load()',delay); 
		}
		
}


function init_main(){

if(is_msie){auPreload();}


//	document.onmousemove=handlemousemove;
	document.onmousedown=handlemousedown;
	document.onmouseup=handlemouseup;

	document.getElementById("div_exittomenu").style.visibility="visible";

//	document.getElementById("image_background").src=pic[23].src;
	document.body.style.background="url('"+pic[23].src+"') black top left no-repeat fixed "

	for (i=1; i<=10; i++){
		document.getElementById("image_smiley"+i).src="../themes/sea/duck_swimming_left1.gif";
	}

//	document.getElementById("div_background").style.visibility="visible";

	document.getElementById("div_instructions").style.visibility="hidden";
	document.getElementById("div_imgthumb").style.visibility="hidden";
	document.getElementById("div_linkbacktomenu").style.visibility="hidden";
	document.getElementById("div_linkbacktomathgames").style.visibility="hidden";






	for (i=1; i<19; i++) {
		obj[i]=new obj_prototype();	
	}

	
	document.getElementById("div_achadot1").style.visibility="visible";
	document.getElementById("div_asarot1").style.visibility="visible";
	document.getElementById("div_meot1").style.visibility="visible";
	document.getElementById("btnrunfirsttime").style.visibility="hidden";
	document.getElementById("div_btnrunfirsttime").style.visibility="hidden";
	document.getElementById("btnrestart").style.visibility="hidden";
	document.getElementById("btnbacktomenu").style.visibility="hidden";

	
	document.getElementById("div_sentence1").style.visibility="visible";
	document.getElementById("div_sentence2").style.visibility="hidden";



	init_this_task_variables();

	assign_divs_and_images_to_objects();	

	run_main_animation();

}

function init_this_task_variables(){

	for (i=1; i<19; i++){

		// SET LOCATIONS FOR THE feedback ITEMS
		if (i<6) {obj[i].feedback_target_x=i*70;} else {obj[i].feedback_target_x=(i-5)*70;}

		if (i<6) {obj[i].feedback_target_y=420;} else {obj[i].feedback_target_y=450;}



		//EXTRACT THE NUMBERS INTO DIGITS - ACHADOT, ASAROT, MEOT
		number_to_extract_temp=obj[i].number_to_click_on;

		obj[i].achadot=number_to_extract_temp%10;
		number_to_extract_temp=number_to_extract_temp-obj[i].achadot;
		number_to_extract_temp=number_to_extract_temp/10;

		obj[i].asarot=number_to_extract_temp%10;
		number_to_extract_temp=number_to_extract_temp-obj[i].asarot;
		number_to_extract_temp=number_to_extract_temp/10;

		obj[i].meot=number_to_extract_temp%10;
		number_to_extract_temp=number_to_extract_temp-obj[i].asarot;
		number_to_extract_temp=number_to_extract_temp/10;



	}




	
}


function assign_divs_and_images_to_objects(){   //THIS IS RELEVANT TO A SPECIFIC TRIAL


		if(obj[trial].sifra_lilchots=="achadot") {str1="ONES"}
		if(obj[trial].sifra_lilchots=="asarot") {str1="TENS"}
		if(obj[trial].sifra_lilchots=="meot") {str1="HUNDREDS"}

		sentence2=str1;
		sentence1="Please click the "+str1+" digit";	
		document.getElementById("txbx_sentence1").value=sentence1;	
		document.getElementById("txbx_sentence1").style.textAlign='left';	
		document.getElementById("txbx_sentence1").style.fontSize=30;	
		document.getElementById("txbx_sentence1").style.height=50;	
		document.getElementById("txbx_sentence1").style.color='#0000aa';	

		document.getElementById("txbx_sentence2").value=sentence2;	
		document.getElementById("txbx_sentence2").style.textAlign='center';	
		document.getElementById("txbx_sentence2").style.fontSize=30;	
		document.getElementById("txbx_sentence2").style.height=40;	
		document.getElementById("txbx_sentence2").style.color='#8888cc';
		document.getElementById("txbx_sentence2").style.background='#000022';


		
			document.getElementById("div_achadot1").style.visibility="visible";
			document.getElementById("div_achadot1").style.left=obj[trial].achadot_x;
			document.getElementById("div_achadot1").style.top=obj[trial].achadot_y; 

			for (i=0; i<10; i++){
				if (obj[trial].achadot==i) {	document.getElementById("image_achadot1").src=pic[i+10].src;} 
			}



			document.getElementById("div_asarot1").style.left=obj[trial].asarot_x;
			document.getElementById("div_asarot1").style.top=obj[trial].asarot_y; 

			for (i=0; i<10; i++){
				if (obj[trial].asarot==i) {	document.getElementById("image_asarot1").src=pic[i+10].src;} 
			}



			document.getElementById("div_meot1").style.left=obj[trial].meot_x;
			document.getElementById("div_meot1").style.top=obj[trial].meot_y; 


			for (i=0; i<10; i++){
				if (obj[trial].meot==i) {	document.getElementById("image_meot1").src=pic[i+10].src;} 
			}


		


}





function obj_prototype(){
	temprand=Math.floor(Math.random()*900+100);

	this.number_to_click_on=temprand;
	this.number_to_extract_temp=temprand;

	this.timer1=0;
	
	do{
		temprand=Math.floor(Math.random()*3);
	}
	while (temprand==lasttemprand);
	lasttemprand=temprand;



	if (temprand==0) {this.sifra_lilchots="achadot";}
	if (temprand==1) {this.sifra_lilchots="asarot";}
	if (temprand==2) {this.sifra_lilchots="meot";}

	temprandx=Math.floor(Math.random()*600+120);
	temprandy=Math.floor(Math.random()*120+140);


	this.achadot=0;
	this.achadot_x=temprandx;
	this.achadot_y=temprandy;

	this.asarot=0;
	this.asarot_x=temprandx-30;
	this.asarot_y=temprandy;

	this.meot=0;
	this.meot_x=temprandx-60;
	this.meot_y=temprandy;

	this.alafim=0;
	this.alafim_x=50;
	this.alafim_y=100;

	this.visibility="false";


	this.feedback_visibility="false";

	this.feedback_x=600;			
	this.feedback_y=600;			

	this.feedback_is_on_its_way="false";

	this.feedback_movespeed1=0;
	this.feedback_origin_x=900;
	this.feedback_origin_y=400;
	this.feedback_target_x=100;
	this.feedback_target_y=100;



}



function run_main_animation(){

	// IF THERE IS A CORRECT CLICK

	if ((checkforcontact(obj[trial].sifra_lilchots)=="true") && (ready_for_a_new_trial=="true")) {

		mousex=0; mousey=0;

		document.getElementById("div_feedback"+trial).style.visibility="visible";
		obj[trial].feedback_x=obj[trial].feedback_origin_x;
		obj[trial].feedback_y=obj[trial].feedback_origin_y;


		ready_for_a_new_trial="false";

		if(is_msie){playsound_ie(0)}; 
		if(is_chrome){playsound_chrome(0);}
	
		obj[trial].feedback_is_on_its_way="true";

		animate_the_numebrs();

		// preparing the new trial
		trial=trial+1;

		
		
		obj[trial].timer1=160;
		
	}



// animating the wrong feedback	

if(wrong_achadot_timer>0){
//	wrong_asarot_timer=2; wrong_meot_timer=2;
	document.getElementById("div_answerfeedback").style.visibility="visible";
	mousex=0; mousey=0;
	wrong_achadot_timer=wrong_achadot_timer-1;

	document.getElementById("txtarea_answerfeedback").style.width="300";
	document.getElementById("txtarea_answerfeedback").value="You clicked the ONES.\nPlease try again.";		
		document.getElementById("div_answerfeedback").style.opacity=wrong_achadot_timer/100;
		document.getElementById("div_answerfeedback").style.filter = 'alpha(opacity=' + wrong_achadot_timer + ')';



} else {
	document.getElementById("div_answerfeedback").style.visibility="hidden";

  }


  if(wrong_asarot_timer>0){
//	wrong_achadot_timer=2; wrong_meot_timer=2;
	document.getElementById("div_answerfeedback").style.visibility="visible";
	mousex=0; mousey=0;
	wrong_asarot_timer=wrong_asarot_timer-1;

	document.getElementById("txtarea_answerfeedback").style.width="280";
	document.getElementById("txtarea_answerfeedback").value="You clicked the TENS.\nPlease try again.";		
		document.getElementById("div_answerfeedback").style.opacity=wrong_asarot_timer/100;
		document.getElementById("div_answerfeedback").style.MozOpacity=wrong_asarot_timer/100;
		document.getElementById("div_answerfeedback").style.filter = 'alpha(opacity=' + wrong_asarot_timer + ')';


  }


if(wrong_meot_timer>0){
	
//	wrong_achadot_timer=2; wrong_asarot_timer=2;
	document.getElementById("div_answerfeedback").style.visibility="visible";
	mousex=0; mousey=0;
	wrong_meot_timer=wrong_meot_timer-1;

	document.getElementById("txtarea_answerfeedback").style.width="330";
	document.getElementById("txtarea_answerfeedback").value="You clicked the HUNDREDS.\nPlease try again.";		
		document.getElementById("div_answerfeedback").style.opacity=wrong_meot_timer/100;
		document.getElementById("div_answerfeedback").style.MozOpacity=wrong_meot_timer/100;
		document.getElementById("div_answerfeedback").style.filter = 'alpha(opacity=' + wrong_meot_timer + ')';

	}






		// animate the elements (digits and feedbacks)

	for (i4=1; i4<18; i4++){

		if (obj[i4].timer1>1) {obj[i4].timer1=obj[i4].timer1-1;}

		if (obj[i4].timer1==1) {
			assign_divs_and_images_to_objects();			
			obj[i4].timer1=0;

			// if collected all 10 ducks - end of game

			if (i4==11) {

				document.getElementById("div_sentence1").style.visibility="hidden"; 
				document.getElementById("div_achadot1").style.visibility="hidden"; 
				document.getElementById("div_asarot1").style.visibility="hidden"; 
				document.getElementById("div_meot1").style.visibility="hidden"; 
				document.getElementById("txbx_sentence2").value="Great job! You collected all 10 ducks!";	
				document.getElementById("div_sentence2").style.visibility="visible"; 

				document.getElementById("div_btnrestart").style.visibility="visible"; 
				document.getElementById("btnrestart").style.visibility="visible"; 
				document.getElementById("div_backtomenu").style.visibility="visible"; 
				document.getElementById("div_exittomenu").style.visibility="hidden"; 
				document.getElementById("btnbacktomenu").style.visibility="visible"; 
				document.getElementById("div_btnrestart").style.left=10; 
				document.getElementById("div_backtomenu").style.left=10; 
				document.getElementById("btnrestart").style.width=160; 
				document.getElementById("btnbacktomenu").style.width=160; 
				document.getElementById("btnrestart").style.fontSize=20; 
				document.getElementById("btnbacktomenu").style.fontSize=20; 
				document.getElementById("btnrestart").value="Restart"; 
				





			} else {ready_for_a_new_trial=="true";}
		}
			

		if (obj[i4].feedback_is_on_its_way=="true") {


//			document.getElementById("txbx_sentence1").value=i4;	

				//move the feedback on the x axis towards its target.
			if (obj[i4].feedback_x>obj[i4].feedback_target_x) { obj[i4].feedback_x=obj[i4].feedback_x-5;}
				else
					{if (obj[i4].feedback_x<obj[i4].feedback_target_x) { obj[i4].feedback_x=obj[i4].feedback_x+5;}}

				//move the feedback on the y axis towards its target.


			if (obj[i4].feedback_y>obj[i4].feedback_target_y) { obj[i4].feedback_y=obj[i4].feedback_y-5; 	}
				else {		if (obj[i4].feedback_y<obj[i4].feedback_target_y) { obj[i4].feedback_y=obj[i4].feedback_y+5;}}



			document.getElementById("div_feedback"+i4).style.left=obj[i4].feedback_x;
			document.getElementById("div_feedback"+i4).style.top=obj[i4].feedback_y;
		

		}
	}




	setTimeout('run_main_animation()',delay);
}



         
function animate_the_numebrs(){


	for (i3=0; i3<10; i3++){

		if (obj[trial].sifra_lilchots=="achadot"){
			if (obj[trial].achadot==i3) {	document.getElementById("image_achadot1").src=pic[i3].src;} 
		}

		if (obj[trial].sifra_lilchots=="asarot"){
			if (obj[trial].asarot==i3) {	document.getElementById("image_asarot1").src=pic[i3].src;} 
		}

		if (obj[trial].sifra_lilchots=="meot"){
			if (obj[trial].meot==i3) {	document.getElementById("image_meot1").src=pic[i3].src;} 
		}
	} 


}





function handlemousedown(evt) {

	var e = (window.event) ? window.event : evt; 

	

	if (e.pageX)  {  				//firefox

		mousex=e.pageX; //event.clientX;
		mousey=e.pageY; //event.clientY;
	} else {  					//IE
		mousex=event.clientX;
		mousey=event.clientY;

	}

	
	return true;
}

function handlemouseup(evt) {

	ready_for_a_new_trial="true";


	return true;
}


function checkforcontact(what_to_check){

var rtemp="false";

	if (what_to_check=="achadot"){
		x1=obj[trial].achadot_x; x2=obj[trial].achadot_x+32;
		y1=obj[trial].achadot_y; y2=obj[trial].achadot_y+68;
	}

	if (what_to_check=="asarot"){
		x1=obj[trial].asarot_x; x2=obj[trial].asarot_x+32;
		y1=obj[trial].asarot_y; y2=obj[trial].asarot_y+68;
	}

	if (what_to_check=="meot"){
		x1=obj[trial].meot_x; x2=obj[trial].meot_x+32;
		y1=obj[trial].meot_y; y2=obj[trial].meot_y+68;
	}

		x3=mousex; 	x4=mousex+2;
		y3=mousey; 	y4=mousey+2;
	
		if(x3>x1&&x3<x2&&y3>y1&&y3<y2) rtemp="true";
		if(x4>x1&&x4<x2&&y3>y1&&y3<y2) rtemp="true";
		if(x3>x1&&x3<x2&&y4>y1&&y4<y2) rtemp="true";
		if(x4>x1&&x4<x2&&y4>y1&&y4<y2) rtemp="true";
		
		if(x2>x3&&x2<x4&&y2>y3&&y2<y4) rtemp="true";
		if(x1>x3&&x1<x4&&y2>y3&&y2<y4) rtemp="true";
		if(x2>x3&&x2<x4&&y1>y3&&y1<y4) rtemp="true";
		if(x1>x3&&x1<x4&&y1>y3&&y1<y4) rtemp="true";	



	if (wrong_achadot_timer==0&&(what_to_check=="asarot"||what_to_check=="meot")){
		wrong_achadot="false";
	
		x5=obj[trial].achadot_x; x6=obj[trial].achadot_x+32;
		y5=obj[trial].achadot_y; y6=obj[trial].achadot_y+68;

		if(x3>x5&&x3<x6&&y3>y5&&y3<y6) wrong_achadot="true";
		if(x4>x5&&x4<x6&&y3>y5&&y3<y6) wrong_achadot="true";
		if(x3>x5&&x3<x6&&y4>y5&&y4<y6) wrong_achadot="true";
		if(x4>x5&&x4<x6&&y4>y5&&y4<y6) wrong_achadot="true";
		
		if(x6>x3&&x6<x4&&y6>y3&&y6<y4) wrong_achadot="true";
		if(x5>x3&&x5<x4&&y6>y3&&y6<y4) wrong_achadot="true";
		if(x6>x3&&x6<x4&&y5>y3&&y5<y4) wrong_achadot="true";
		if(x5>x3&&x5<x4&&y5>y3&&y5<y4) wrong_achadot="true";	

		if (wrong_achadot=="true"){  if (is_msie==false)	{wrong_achadot_timer=300; wrong_asarot_timer=0; wrong_meot_timer=0; if(is_msie){playsound_ie(1)}; if(is_chrome){playsound_chrome(1);}} else {wrong_achadot_timer=230; wrong_asarot_timer=0; wrong_meot_timer=0; if(is_msie){playsound_ie(1)}; if(is_chrome){playsound_chrome(1);}}
		}

	}

	if (wrong_asarot_timer==0&&(what_to_check=="achadot"||what_to_check=="meot")){
		wrong_asarot="false";
	
		x5=obj[trial].asarot_x; x6=obj[trial].asarot_x+32;
		y5=obj[trial].asarot_y; y6=obj[trial].asarot_y+68;

		if(x3>x5&&x3<x6&&y3>y5&&y3<y6) wrong_asarot="true";
		if(x4>x5&&x4<x6&&y3>y5&&y3<y6) wrong_asarot="true";
		if(x3>x5&&x3<x6&&y4>y5&&y4<y6) wrong_asarot="true";
		if(x4>x5&&x4<x6&&y4>y5&&y4<y6) wrong_asarot="true";
		
		if(x6>x3&&x6<x4&&y6>y3&&y6<y4) wrong_asarot="true";
		if(x5>x3&&x5<x4&&y6>y3&&y6<y4) wrong_asarot="true";
		if(x6>x3&&x6<x4&&y5>y3&&y5<y4) wrong_asarot="true";
		if(x5>x3&&x5<x4&&y5>y3&&y5<y4) wrong_asarot="true";	

		if (wrong_asarot=="true"){  if (is_msie==false)	{wrong_asarot_timer=300; wrong_achadot_timer=0; wrong_meot_timer=0; if(is_msie){playsound_ie(1)}; if(is_chrome){playsound_chrome(1);}} else {wrong_asarot_timer=230; wrong_achadot_timer=0; wrong_meot_timer=0; if(is_msie){playsound_ie(1)}; if(is_chrome){playsound_chrome(1);}}
		}

	}

	if (wrong_meot_timer==0&&(what_to_check=="achadot"||what_to_check=="asarot")){
		wrong_meot="false";
	
		x5=obj[trial].meot_x; x6=obj[trial].meot_x+32;
		y5=obj[trial].meot_y; y6=obj[trial].meot_y+68;

		if(x3>x5&&x3<x6&&y3>y5&&y3<y6) wrong_meot="true";
		if(x4>x5&&x4<x6&&y3>y5&&y3<y6) wrong_meot="true";
		if(x3>x5&&x3<x6&&y4>y5&&y4<y6) wrong_meot="true";
		if(x4>x5&&x4<x6&&y4>y5&&y4<y6) wrong_meot="true";
		
		if(x6>x3&&x6<x4&&y6>y3&&y6<y4) wrong_meot="true";
		if(x5>x3&&x5<x4&&y6>y3&&y6<y4) wrong_meot="true";
		if(x6>x3&&x6<x4&&y5>y3&&y5<y4) wrong_meot="true";
		if(x5>x3&&x5<x4&&y5>y3&&y5<y4) wrong_meot="true";	

		if (wrong_meot=="true"){  if (is_msie==false)	{wrong_achadot_timer=0; wrong_asarot_timer=0; wrong_meot_timer=300; if(is_msie){playsound_ie(1)}; if(is_chrome){playsound_chrome(1);}} else {wrong_achadot_timer=0; wrong_asarot_timer=0; wrong_meot_timer=230; if(is_msie){playsound_ie(1)}; if(is_chrome){playsound_chrome(1);}}
		}

	}
	
	
	return rtemp;
}	


					// IE Sound Script

						// DO NOT edit below this line
						document.write('<BGSOUND ID="auIEContainer">')
						IE = (navigator.userAgent.toLowerCase().indexOf('msie')>-1)? 1:0;
						


						function auPreload() {
							Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>";
							document.body.insertAdjacentHTML("BeforeEnd",Str);
							var Str = '';
							for (i=0;i<aySound.length;i++)
							Str += "<EMBED SRC='"+aySound[i].src+"' AUTOSTART='FALSE' HIDDEN='TRUE'>"
							auEmb.innerHTML = Str;
							auCon = document.all.auIEContainer;
							auCon.control = auCtrl;
						}

						function auCtrl(whSound,play) {
							if(play==true){this.src=aySound[whSound].src};
						}

						function playsound_ie(whSound) {auCon.control(whSound,true); }

						function stopsound_ie(whSound) { if (window.auCon) auCon.control(whSound,false); }


					// Chrome Sound Script

						function playsound_chrome(tslil){
//							document.getElementById("sound_element").innerHTML="<embed src='"+aySound[tslil].src+"' hidden=true autostart=true loop=false>";
						}

