function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function RectangleSize(w,h) {
	this.w=w;
	this.h=h;
}

function getWinSize() {
	var w=0;
	var h=0;
	if (window.innerWidth) {
		w=window.innerWidth;
		h=window.innerHeight;
	} else if (document.body.offsetWidth) {
		w=document.body.offsetWidth-4;
		h=document.body.offsetHeight-4;
	}
	return new RectangleSize(w,h);
}

function getTopLeft (lw,lh) {
	var winSize=getWinSize();
	var myleft=(winSize.w-lw)/2;
	if (myleft < 0) {
		myleft=0;
	}
	var mytop=(winSize.h-lh)/2;
	if (mytop < 0) {
		mytop=0;
	}
	return new RectangleSize(myleft,mytop);
}

function adjustLayer(myLayer,myOrigin,myTopLeft) { 
	var md=MM_findObj(myLayer);
	myLeft=myOrigin.w+myTopLeft.w;
	myTop=myOrigin.h+myTopLeft.h;
	if (!md.style) {
		md.x=myLeft;
		md.y=myTop;
	} else {
		md.style.left=myLeft+"px";
		md.style.top=myTop+"px";
	}	
}
function moveLayer(myLayer,x,y) { 
	var md=MM_findObj(myLayer);
	myLeft=x;
	myTop=y;
	if (!md.style) {
		md.x=myLeft;
		md.y=myTop;
	} else {
		md.style.left=myLeft+"px";
		md.style.top=myTop+"px";
	}	
}

function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
return totaloffset;
}
// Initialize the Map
var rollMap=Object();
rollMap['bio']={'iname':'bio','iroll':'../Resources/images/LayoutV3/bio_f2.jpg'};
rollMap['recordings']={'iname':'recordings','iroll':'../Resources/images/LayoutV3/recordings_f2.jpg'};
rollMap['calendar']={'iname':'calendar','iroll':'../Resources/images/LayoutV3/calendar_f2.jpg'};
rollMap['critrev']={'iname':'critrev','iroll':'../Resources/images/LayoutV3/critrev_f2.jpg'};
rollMap['repertoire']={'iname':'repertoire','iroll':'../Resources/images/LayoutV3/repertoire_a_f2.jpg'};
rollMap['audio']={'iname':'audio','iroll':'../Resources/images/LayoutV3/audio_f2.jpg'};
rollMap['perprofile']={'iname':'perprofile','iroll':'../Resources/images/LayoutV3/perprofile_f2.jpg'};
rollMap['video']={'iname':'video','iroll':'../Resources/images/LayoutV3/video_f2.jpg'};
rollMap['photo']={'iname':'photo','iroll':'../Resources/images/LayoutV3/photo_f2.jpg'};
rollMap['press']={'iname':'press','iroll':'../Resources/images/LayoutV3/press_f2.jpg'};
rollMap['contact']={'iname':'contact','iroll':'../Resources/images/LayoutV3/contact_f2.jpg'};
rollMap['home']={'iname':'home','iroll':'../Resources/images/LayoutV3/home_f2.jpg'};
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


var myPageName='';
function pageRoll() {
	if (rollMap[myPageName]) {
		MM_swapImage(rollMap[myPageName].iname,'',rollMap[myPageName].iroll,0);
	}
}
function PageSwapImgRestore() {
	MM_swapImgRestore();
	pageRoll();
}
function jorgeImageLoad() {
	pageRoll();
	MM_preloadImages(
		'../Resources/images/LayoutV3/bio_f2.jpg',
		'../Resources/images/LayoutV3/recordings_f2.jpg',
		'../Resources/images/LayoutV3/calendar_f2.jpg',
		'../Resources/images/LayoutV3/critrev_f2.jpg',
		'../Resources/images/LayoutV3/repertoire_a_f2.jpg',
		'../Resources/images/LayoutV3/audio_f2.jpg',
		'../Resources/images/LayoutV3/perprofile_f2.jpg',
		'../Resources/images/LayoutV3/video_f2.jpg',
		'../Resources/images/LayoutV3/photo_f2.jpg',
		'../Resources/images/LayoutV3/press_f2.jpg',
		'../Resources/images/LayoutV3/contact_f2.jpg',
		'../Resources/images/LayoutV3/home_f2.jpg'
	);
}