//Open the details of a project in the home page Benjamin
function toggleDetails(thisID,projects){
	if(!thisID){
		return false;
	}
	else{
		getCadre = document.getElementsByName("cadre"+thisID);
		getCadre2 = document.getElementsByName("cadre2"+thisID);
		getButtons = document.getElementsByName("button"+thisID);
		getDetails = document.getElementsByName("details"+thisID);
		//For Mr IE getElementsByName count the id's and not the name Benjamin
		if(projects != null && (projects == "0" || projects == "1")){
			for(i=0;i<=(getDetails.length);i++){
				//If we are in recently projects window Benjamin
				if(projects == "0")
				{
					if(getDetails[0].style.display == "block"){
						getDetails[0].style.display = "none";
						getCadre[0].style.borderBottom = "0";
						getCadre2[0].style.borderBottom = "0";
						getButtons[0].style.borderBottom = "1px solid #6699CC";
						getButtons[0].style.background = "url(/templates/v2/images/details-open.gif) no-repeat right";
						return;
						
					}
					else{
						getDetails[0].style.display = "block";
						getCadre[0].style.borderBottom = "1px solid #6699CC";
						getCadre2[0].style.borderBottom = "1px solid #6699CC";
						getButtons[0].style.borderBottom = "0";
						getButtons[0].style.background = "url(/templates/v2/images/details-close.gif) no-repeat right";
						return;
					}
				}
				//if we are in Ended soon window Benjamin
				else if(projects == "1")
				{
					if(getDetails[1] != null)
					{
						if(getDetails[1].style.display == "block"){
							getDetails[1].style.display = "none";
							getCadre[1].style.borderBottom = "0";
							getCadre2[1].style.borderBottom = "0";
							getButtons[1].style.borderBottom = "1px solid #6699CC";
							getButtons[1].style.background = "url(/templates/v2/images/details-open.gif) no-repeat right";
							return;
							
						}
						else{
							getDetails[1].style.display = "block";
							getCadre[1].style.borderBottom = "1px solid #6699CC";
							getCadre2[1].style.borderBottom = "1px solid #6699CC";
							getButtons[1].style.borderBottom = "0";
							getButtons[1].style.background = "url(/templates/v2/images/details-close.gif) no-repeat right";
							return;
						}
					}
					else
					{
						if(getDetails[i].style.display == "block"){
							getDetails[i].style.display = "none";
							getCadre[i].style.borderBottom = "0";
							getCadre2[i].style.borderBottom = "0";
							getButtons[i].style.borderBottom = "1px solid #6699CC";
							getButtons[i].style.background = "url(/templates/v2/images/details-open.gif) no-repeat right";
							return;
						}
						else if(getDetails[i].style.display == "none"){
							getDetails[i].style.display = "block";
							getCadre[i].style.borderBottom = "1px solid #6699CC";
							getCadre2[i].style.borderBottom = "1px solid #6699CC";
							getButtons[i].style.borderBottom = "0";
							getButtons[i].style.background = "url(/templates/v2/images/details-close.gif) no-repeat right";
							return;
						}
					}
				}
			}
		}
		else
		{
			for(i=0;i<=(getDetails.length)-1;i++){
				if(getDetails[i].style.display == "none"){
					getDetails[i].style.display = "block";
					getCadre[i].style.borderBottom = "1px solid #6699CC";
					getCadre2[i].style.borderBottom = "1px solid #6699CC";
					getButtons[i].style.borderBottom = "0";
					getButtons[i].style.background = "url(/templates/v2/images/details-close.gif) no-repeat right";
					return;
				}
				else{
					getDetails[i].style.display = "none";
					getCadre[i].style.borderBottom = "0";
					getCadre2[i].style.borderBottom = "0";
					getButtons[i].style.borderBottom = "1px solid #6699CC";
					getButtons[i].style.background = "url(/templates/v2/images/details-open.gif) no-repeat right";
					return;
				}
			}
		}
	}
}

//Open/Close categories on post project Benjamin
function toggleCategory(thisCAT){
	if(!thisCAT){
		return false;
	}
	else{
		getCategories = document.getElementsByName(thisCAT);
		getCategory = document.getElementsByName('cat_'+thisCAT);
		for(i=0;i<=(getCategories.length)-1;i++){
			if(getCategories[i].style.display == "none"){
				getCategories[i].style.display = "block";
				getCategory[i].innerHTML = '- <b><a href="javascript:toggleCategory(\''+thisCAT+'\')">'+thisCAT+'</a></b>';
			}
			else{
				getCategories[i].style.display = "none";
				getCategory[i].innerHTML = '+ <b><a href="javascript:toggleCategory(\''+thisCAT+'\')">'+thisCAT+'</a></b>';
			}
		}
	}
}

//Open PM board in new window Benjamin
function popup(page) {
	window.open(page,"nom_popup","menubar=no, status=no, scrollbars=yes, menubar=no, width=1000, height=500");
}