  // JavaScript Document


var rotatename="";
var rotateimagecount="";
var imageids=new Array();


//var mediaid="rotate-prm-4-0-1-2-3";

function writeimages(a){ 
			var a;
			var imagestring;
			temp=mediaid.split("-");
			rotatename=temp[1];
			rotateimagecount=temp[2];
			rotateimagecount= parseInt(rotateimagecount);
			imageidnumber=rotateimagecount-1;

			for(i=0; i<rotateimagecount;i++){
			imagestring="<img id='image" + (i) + "' class='"+ a +"media_loop' src='/images/media/rotate/" + rotatename +  "-" + temp[i+3] + ".jpg'>";
			document.write(imagestring);
			
			}



}






//looping functions for  page images ************************************************************

var z = 101;
var icounter=0;
var opacitynum=0;
var opacitytimer0="";
var opacitytimer1="";

function rotateimages(){
	if(z==110)fixz();
//for ie
	if(document.all != null){
		if(icounter==(rotateimagecount-1)){ 
			icounter=0;
			document.getElementById("image"+ icounter).style.filter = "alpha(opacity=0)";
			z++;
			document.getElementById("image"+ icounter).style.zIndex = z;
			loopit();
			}
		else{
			icounter++;
			document.getElementById("image"+ icounter).style.filter = "alpha(opacity=0)";
			z++;
			document.getElementById("image"+ icounter).style.zIndex = z;
			loopit();
			}
		}
//all others
	else{
		if(icounter==(rotateimagecount-1)){ 
			icounter=0;
			document.getElementById("image"+ icounter).style.opacity = 0;
			z++;
			document.getElementById("image"+ icounter).style.zIndex = z;
			loopit();
			}
		else{
			icounter++; 
			document.getElementById("image"+ icounter).style.opacity = 0;
			z++;
			document.getElementById("image"+ icounter).style.zIndex = z;
			loopit();
			}
		}
		return;
}

function fixz(){
	
for(i=0; i<rotateimagecount;i++){
	document.getElementById("image" + i).style.zIndex = 101;
}
	
	document.getElementById("image"+ icounter).style.zIndex = 102;
	z=102;
	return;
}

function loopit(){ 
//ie
	if(document.all != null){
		opacitynum=0;
		opacitytimer0=window.setInterval('fadein0()',20);
		}
//for all others
	else {
		opacitynum=0;
		opacitytimer1=window.setInterval('fadein1()',20);
		}
}



//for firefox and others
function fadein1(){	
	opacitynum=opacitynum+.005;
	document.getElementById("image"+ icounter).style.opacity = opacitynum;
		if(opacitynum>=2){ 
		window.clearInterval(opacitytimer1);
		rotateimages();
		}

}
//for ie
function fadein0(){	
	opacitynum=opacitynum+1;
	document.getElementById("image"+ icounter).style.filter="alpha(opacity=" + (opacitynum) + ")"; 
		if(opacitynum>=200){
		window.clearInterval(opacitytimer0);
		rotateimages();
		}

}

