

// ===================================================================
//	Redirect user to matching french page by replaceing /en/ and /fr/
// ===================================================================
function langSwitch() {

	// wish hero special case
	if (location.href == "http://www.childrenswish.ca/champions.de.reves/" || location.href == "http://www.childrenswish.ca/wish.heroes/" ){
		if (location.href == "http://www.childrenswish.ca/wish.heroes/"){
			window.location = "http://www.childrenswish.ca/champions.de.reves/";
		}
		if (location.href == "http://www.childrenswish.ca/champions.de.reves/"){
			window.location = "http://www.childrenswish.ca/wish.heroes/";
		} 	
		return;
	}
	
	if (location.href.indexOf("/en/") > 0 ){
		currentUrl = location.href;
		newUrl = currentUrl.replace("/en/", "/fr/");
		window.location = newUrl;
	}else{
		currentUrl = location.href;
		newUrl = currentUrl.replace("/fr/", "/en/");
		window.location = newUrl;
	}
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// Check form fields to make sure they are all filled in
function sendVolunteerFormEn(form){
 	if (form.Name.value == "" || form.Address1.value == "" || form.City.value == "" || form.Province.value == "" || form.PostalCode.value == ""  || form.Telephone.value == ""  || form.Email.value == "")  {
		alert("Missing contact information.   All fields are required except Address 2 and Fax");
		return false
	}
}
function sendVolunteerFormFr(form){
 	if (form.Name.value == "" || form.Address1.value == "" || form.City.value == "" || form.Province.value == "" || form.PostalCode.value == ""  || form.Telephone.value == ""  || form.Email.value == "")  {
		alert("Coordonnées manquantes. Tous les champs doivent être complétés sauf 'Adresse' et 'Fax'");
		return false
	}
}


function newsLettterFormEn(form){
 	if (form.firstname.value == "" || form.lastname.value == "" || form.Street.value == "" || form.City.value == ""  || form.Province.value == "" || form.postalcode.value == ""  || form.phone.value == ""  || form.email.value == "")  {
		alert("Missing contact information.  All fields are required");
		return false
	}
}

function newsLettterFormFr(form){
 	if (form.firstname.value == "" || form.lastname.value == "" || form.Street.value == "" || form.City.value == ""  || form.Province.value == "" || form.postalcode.value == ""  || form.phone.value == ""  || form.email.value == "")  {
		alert("Coordonnées manquantes. Tous les champs doivent être complétés");
		return false
	}
}


// open send to a friend window
var  sendfriendWindow
function sendfriend(currentUrl){
		if(!currentUrl){
			currentUrl = self.location.href;
		}
		if (sendfriendWindow && !sendfriendWindow.closed){		  // Checks to see if a window is already open
			sendfriendWindow.close();
			sendfriendWindow =  window.open('http://www.childrenswish.ca/sendfriend/eng/index.php?referURL='+currentUrl,'','width=475,scrollbars=1,height=400,noresize');
		}else{
			sendfriendWindow =  window.open('http://www.childrenswish.ca/sendfriend/eng/index.php?referURL='+currentUrl,'','width=475,scrollbars=1,height=400,noresize');
		}
}

function sendfriendfr(currentUrl){
		if(!currentUrl){
			currentUrl = self.location.href;
		}
		if (sendfriendWindow && !sendfriendWindow.closed){		  // Checks to see if a window is already open
			sendfriendWindow.close();
			sendfriendWindow =  window.open('http://www.childrenswish.ca/sendfriend/frn/index.php?referURL='+currentUrl,'','width=475,scrollbars=1,height=400,noresize');
		}else{
			sendfriendWindow =  window.open('http://www.childrenswish.ca/sendfriend/frn/index.php?referURL='+currentUrl,'','width=475,scrollbars=1,height=400,noresize');
		}
}

var  partnerWindow
function showPartnerEn(storyId){
		if (partnerWindow && !partnerWindow.closed){		  // Checks to see if a window is already open
			partnerWindow.close();
			partnerWindow =  window.open('http://www.childrenswish.ca/index_2007.php/en/partners/highlight/' + storyId,'','width=550,scrollbars=1,height=400,noresize');
		}else{
			partnerWindow =  window.open('http://www.childrenswish.ca/index_2007.php/en/partners/highlight/' + storyId,'','width=550,scrollbars=1,height=400,noresize');
		}
}

function showPartnerFr(storyId){
		if (partnerWindow && !partnerWindow.closed){		  // Checks to see if a window is already open
			partnerWindow.close();
			partnerWindow =  window.open('http://www.childrenswish.ca/index_2007.php/fr/partners/highlight/' + storyId,'','width=550,scrollbars=1,height=400,noresize');
		}else{
			partnerWindow =  window.open('http://www.childrenswish.ca/index_2007.php/fr/partners/highlight/' + storyId,'','width=550,scrollbars=1,height=400,noresize');
		}
}

var  printWindow
function printPage(currentUrl){
		if(!currentUrl){
			currentUrl = self.location.href;
		}
		if (printWindow && !printWindow.closed){		  // Checks to see if a window is already open
			printWindow.close();
			printWindow =  window.open(currentUrl+"/print/print/",'','width=475,scrollbars=1,height=400,noresize');
		}else{
			printWindow =  window.open(currentUrl+"/print/print/",'','width=475,scrollbars=1,height=400,noresize');
		}
}