function pageload(){
	switchonload();
	switchonloadPortrait();
}

function switchidPortrait(id,idmax){
	var ids=new Array
	for (var i=0;i<=idmax;i++){
		ids.push(i);
	}
	hideallidsPortrait(ids);
	showdivPortrait(id);
}

function hideallidsPortrait(ids){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidedivPortrait(ids[i]);
	}		  
}

function hidedivPortrait(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdivPortrait(id) {
	//safe function to show an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
	document.getElementById(id).style.display = 'block';
			}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function switchonloadPortrait() {
	var id = extractUrlParamsPortrait('tab_id',location.search.substring(1));
	showdivPortrait(id);
}

function extractUrlParamsPortrait(param,url)
{
	var u = url == undefined ? document.location.href : url;
	var reg = new RegExp('(\\?|&|^)'+param+'=(.*?)(&|$)');
	if(	matches = u.match(reg)){
		return matches[2] != undefined ? decodeURIComponent(matches[2]).replace(/\+/g,' ') : '';
	}
	else return 0;
}
