//<script>
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;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

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];}
}

/* DUAL IMAGE ROLLOVER SCRIPT */

img0 = new Image();
img1 = new Image();
img2 = new Image();
img3 = new Image();
img4 = new Image();
img5 = new Image();
img6 = new Image();
img7 = new Image();


liElem=" ";

li0=" ";
li1=" ";
li2=" ";
li3=" ";
li4=" ";
li5=" ";
li6=" ";
li7=" ";

level0="";

function niveau1()
{
++level0;
}

function setOverLi (num){
	if (document.getElementById && level0 >=1)
	{
		liElem=document.getElementById("li" + num);
		liElem.className = "subnav1Over";
		imgElem=document.getElementById("Image" + num);
		imgElem.setAttribute("src","/NR/ContentConnector/CS2000/SiteInterface/Casting/images/over" + num + ".jpg");
	}
	else if (document.getElementById && level0 <1)
	{
		/*
		DO NOTHING
		liElem=document.getElementById("li" + num);		
		liElem=document.getElementById("liright");		
		*/		
	}
}

function setOutLi (num){
	if(document.getElementById && level0 >=1){
		liElem=document.getElementById("li" + num);
		liElem.className = "subnav1";
		imgElem=document.getElementById("Image" + num);
		imgElem.setAttribute("src","/NR/ContentConnector/CS2000/SiteInterface/Casting/images/out" + num + ".jpg");
	}

		else if (document.getElementById && level0 <1)
	{
		/*
		DO NOTHING
		liElem=document.getElementById("li" + num);		
		liElem=document.getElementById("liright");		
		*/
	}
}

function setOverLiRight (num){
	if (document.getElementById && level0 >=1)
	{
		liElem=document.getElementById("li" + num);		
		liElem.className = "subnav1_right_over";
		imgElem=document.getElementById("Image" + num);
		imgElem.setAttribute("src","/NR/ContentConnector/CS2000/SiteInterface/Casting/images/over" + num + ".jpg");
	}
	else if (document.getElementById && level0 <1)
	{
		/*
		DO NOTHING
		liElem=document.getElementById("li" + num);		
		liElem=document.getElementById("liright");		
		*/		
	}
}

function setOutLiRight (num){
	if(document.getElementById && level0 >=1){
		liElem=document.getElementById("li" + num);		
		liElem.className = "subnav1_right";
		imgElem=document.getElementById("Image" + num);
		imgElem.setAttribute("src","/NR/ContentConnector/CS2000/SiteInterface/Casting/images/out" + num + ".jpg");
	}

		else if (document.getElementById && level0 <1)
	{
		/*
		DO NOTHING
		liElem=document.getElementById("li" + num);		
		liElem=document.getElementById("liright");		
		*/
	}
}

/*SUB DISCIPLINE THUMBNAIL ARROW ROLLOVER */
function setOverThumb (num){
	if (document.getElementById)
	{
		imgElem=document.getElementById("overArrow");
		imgElem.className = ("overArrow" + num);
		imgElem.setAttribute("src","/NR/ContentConnector/CS2000/SiteInterface/Casting/images/overarrow.gif");
	}
	
}
function setOutThumb (num){
	if (document.getElementById)
	{
		imgElem=document.getElementById("overArrow");
		imgElem.className = ("overArrow" + num);
		imgElem.setAttribute("src","/NR/ContentConnector/CS2000/SiteInterface/Casting/images/b.gif");
	}
}

/* Fonctions pour meet the team */
function changePage(cbx, bThisPage, qsVar){
	if (bThisPage == false){
		document.location.href = cbx[cbx.selectedIndex].value;	
	} else {
		var val = cbx[cbx.selectedIndex].value;
		if(val != -1) val = "?" + qsVar + "=" + val;
		else val = "";
		document.location.href = document.location.href.split('?')[0] + val;
	}
}

/* Fonctions pour les auditions dates */
function changePageAuditionDates(cbx, bThisPage, qsVar){
	if (bThisPage == false){
		document.location.href = cbx[cbx.selectedIndex].value;	
	} else {
		var val = cbx[cbx.selectedIndex].value;
		if(val != -1) val = "?" + qsVar + "=" + val;
		else val = "?" + qsVar + "=-1";
		document.location.href = document.location.href.split('?')[0] + val;
	}
}

//Fonction servant a inclure du flash dans une page pour bypasser le Activate de WinXP SP2
function WriteFlashInPage(flashId, width, height){
	document.write("<obj" + "ect classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"" + width + "\" height=\"" + height + "\" id=\"homepage_top\" align=\"middle\">\n" +
		"<pa" + "ram name=\"allowScriptAccess\" value=\"sameDomain\"/>\n" +
		"<pa" + "ram name=\"movie\" value=\"" + flashId + "\" /" + ">\n" +
		"<pa" + "ram name=\"quality\" value=\"high\" /" + ">\n" +
		"<pa" + "ram name=\"bgcolor\" value=\"#ffffff\" /" + ">\n" +
		"<em" + "bed src=\"" + flashId + "\" quality=\"high\" bgcolor=\"#1a1c20\" width=\"" + width + "\" height=\"" + height + "\" name=\"homepage_top\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n" +
		"<" + "/obj" + "ect" + ">");
}

//M�thode pour ouvrir le send to friend en Shadowbox
function sendToFriend(){
  //Code to open result using Shadowbox

var url = "/jobs/casting/home/tellafriend.aspx";

Shadowbox.open({
player:     	'iframe',
title:        	'',
content:   	url,
height:     	595,
width:      	498
}, {});
}

function getLangue(){
	var the_url = document.location.href;
	var prefix = "http://" + document.location.hostname;
	var cirque = "/cirquedusoleil/";
	var toCount = prefix + cirque;
	return the_url.substr(toCount.length,2);
}

//M�thode pour montrer/cacher un div
function showHidediv(cid){

	if(document.getElementById(cid).style.display == "none")
	{
			document.getElementById(cid).style.display = "";
	}
	else
	{
			document.getElementById(cid).style.display = "none";
	}
}

function isNumeric(sText){
 
	var ValidChars = "0123456789."; 
	var IsNumber=true; 
	var Char; 
	
	for (i = 0; i < sText.length && IsNumber == true; i++){ 
	
		Char = sText.charAt(i); 
		
		if (ValidChars.indexOf(Char) == -1){ 
			IsNumber = false; 
		} 
	} 
	return IsNumber; 
} 


function SortAuditionDates(family,column,order){

	//alert("F=" + family + " O=" + column);
	
	var url = window.location.href;
	var tableau = url.split("?");
		
	if(tableau.length >= 1)
	{	
		window.location = tableau[0] + "?choice=" + family + "&sortcolumn=" + column + "&sortorder=" + order;
	}
	else
	{		
		window.location = tableau[0] + "?sortcolumn=" + column + "&sortorder=" + order;
	}	

}