function showonlyone(thechosenone){
	var newboxes = document.getElementsByTagName("div");
	for(var x=0; x<newboxes.length; x++){
		name = newboxes[x].getAttribute("name");
		if(name == 'newboxes'){
			if(newboxes[x].id == thechosenone){
				newboxes[x].style.display = 'block';
			}else{
				newboxes[x].style.display = 'none';
			}
		}
		if(name == 'accordionHeaderBG'){
			if(newboxes[x].id == thechosenone){
				newboxes[x].style.background = "#FFF url('../images/accordion-menu-active-bg.png')repeat-x top left";
			}else{
				newboxes[x].style.background = "#FFF url('../images/accordion-menu-bg.png')repeat-x top left";
			}
		}
		if(name == 'accordionHeaderText'){
			if(newboxes[x].id == thechosenone){
				newboxes[x].style.color = "#FFF";
			}else{
				newboxes[x].style.color = "#000";
			}
		}
	}
	var newspans = document.getElementsByTagName("span");
	for(var y=0; y<newspans.length; y++){
		name = newspans[y].getAttribute("name");
		if(name == 'accordionClickToSee'){
			if(newspans[y].id == thechosenone){
				newspans[y].style.display = 'none';
			}else{
				newspans[y].style.display = 'inline';
			}
		}
		if(name == 'accordionWhiteDown'){
			if(newspans[y].id == thechosenone){
				newspans[y].style.display = 'inline';
			}else{
				newspans[y].style.display = 'none';
			}
		}
	}
}
// ACCORDION MARKET MENU
function showonlyoneMarket(thechosenone){
	var newboxesM = document.getElementsByTagName("div");
	for(var x=0; x<newboxesM.length; x++){
		name = newboxesM[x].getAttribute("name");
		if(name == 'newboxesM'){
			if(newboxesM[x].id == thechosenone){
				newboxesM[x].style.display = 'block';
			}else{
				newboxesM[x].style.display = 'none';
			}
		}
		if(name == 'accordionHeaderBGM'){
			if(newboxesM[x].id == thechosenone){
				newboxesM[x].style.background = "#FFF url('../images/accordion-menu-active-bg.png')repeat-x top left";
			}else{
				newboxesM[x].style.background = "#FFF url('../images/accordion-menu-bg.png')repeat-x top left";
			}
		}
		if(name == 'accordionHeaderTextM'){
			if(newboxesM[x].id == thechosenone){
				newboxesM[x].style.color = "#FFF";
			}else{
				newboxesM[x].style.color = "#000";
			}
		}
	}
	var newspansM = document.getElementsByTagName("span");
	for(var y=0; y<newspansM.length; y++){
		name = newspansM[y].getAttribute("name");
		if(name == 'accordionClickToSeeM'){
			if(newspansM[y].id == thechosenone){
				newspansM[y].style.display = 'none';
			}else{
				newspansM[y].style.display = 'inline';
			}
		}
		if(name == 'accordionWhiteDownM'){
			if(newspansM[y].id == thechosenone){
				newspansM[y].style.display = 'inline';
			}else{
				newspansM[y].style.display = 'none';
			}
		}
	}
}
// TOGGLE TWO
// THIS FUNCTION WILL NO LONGER BE USE .... KEEPING IT ONLY FOR REFERENCE
function toggleMarkets(showHideDiv){
//function toggleMarkets(showHideDiv, switchTextDiv){
	var ele = document.getElementById(showHideDiv);
	//var text = document.getElementById(switchTextDiv);
	if(ele.style.display == "block"){
		ele.style.display = "none";
		//text.innerHTML = "restore";
	}else{
		ele.style.display = "block";
		//text.innerHTML = "collapse";
	}
}
/*
 *Thanks to randomsnippets.com
 *http://www.randomsnippets.com/2008/02/12/how-to-hide-and-show-your-div/
 **/

//========================================================================================================//
// THIS IS THE 'POP-UP WINDOW' BLANKET SCRIPTS
//The following pop-up div was written by Patrick Burt
//A very special thanks for the code =)
//http://www.pat-burt.com/web-development/how-to-do-a-css-popup-without-opening-a-new-window/

function toggle(div_id) {
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}
function blanket_size(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';
	var popUpDiv = document.getElementById(popUpDivVar);
	popUpDiv_height=blanket_height/2-150;//150 is half popup's height
	popUpDiv.style.top = popUpDiv_height + 'px';
}
function window_Hpos(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerWidth;
	} else {
		viewportwidth = document.documentElement.clientWidth;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var popUpDiv = document.getElementById(popUpDivVar);
	window_width=window_width/2-150;//150 is half popup's width
	popUpDiv.style.left = window_width + 'px';
	popUpDiv.style.top = '100px';
}
/*function window_Vpos(popUpDivVar) {
	if (typeof window.innerHeight != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		window_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			window_height = document.body.parentNode.clientHeight;
		} else {
			window_height = document.body.parentNode.scrollHeight;
		}
	}
	var popUpDiv = document.getElementById(popUpDivVar);
	window_height=window_height/2-150;//150 is half popup's height
	popUpDiv.style.top = window_height + 'px';
}*/
function popup(windowname) {
	blanket_size(windowname);
	window_Hpos(windowname);
	//window_Vpos(windowname);
	toggle('blanket');
	toggle(windowname);
}

