/* MCOM Site Modification Functions
 * -----------------------------------------------------------------------------
 * This program is free software; you can redistribute it and/or modify it under 
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 3 of the License, or (at your option) any later version.
 * 
 * This program is distributed AS IS in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * -----------------------------------------------------------------------------
 * Changes made by: oliver@maklott.com
 * Last Changes: 2009 01 23
*/
function setupSite()
{
	createPlayer();
	//fitSiteHeight();
	
	//window.onresize = fitSiteHeight;
	
//	var strHref = window.location.href;
	
//	alert("this location: " + window.location);
//	alert("this url: " + this.location.href);
	
}
function setupSubContentContainer(cat, scat, page)
{
//	alert("setupSubContentContainer ... cat: " + cat + " --- scat: " + scat + " --- page: " + page);
	
	if (this != window.top)
	{
		writeStringToHTMLElement('subContentTitle',activeType);
		writeGroupToHTMLElement('year');
		writeGroupToHTMLElement('album');
		writeGroupToHTMLElement('author');
		writeGroupToHTMLElement('genre');
		writeGroupToHTMLElement('tag');
		
		parent.jshistory.setID('subContentFiltered_frame');
		parent.jshistory.setTarget(jshistory);
		
		if (initItemState)
		{
			setQueryItemStateExclusive('type',initItemState,1);
		}
	}
	else
	{
		var location_url = "index.php";
		
		if (cat) location_url = location_url + "?cat=" + cat;
		if (scat) location_url = location_url + ((cat) ? "&scat=" : "?scat=") + scat;
		if (page) location_url = location_url + ((cat || scat) ? "&page=" : "?page=") + page;
		
	//	alert("setupSubContentContainer ... reload page -> location_url: " + location_url);
		
		window.location.href = location_url;
		
		//alert("this must not be the topmost window !!");
	}
	
	
	/*
	writeStringToHTMLElement('subContentTitle',activeType);
	writeGroupToHTMLElement('year');
	writeGroupToHTMLElement('album');
	writeGroupToHTMLElement('author');
	writeGroupToHTMLElement('genre');
	writeGroupToHTMLElement('tag');
	//fitContentHeight();
	
	//window.onresize = fitContentHeight;
	
	parent.jshistory.setID('subContentFiltered_frame');
	parent.jshistory.setTarget(jshistory);
	
	if (initItemState)
	{
		setQueryItemStateExclusive('type',initItemState,1);
	}
	*/
}

function fitSiteHeight()
{
	var content_height = 0;
	var shadow_height = 0;
	
	if (navigator.appName.search(/Opera/i) == 0)
	{
		content_height = pageHeight() * siteHeight;
		shadow_height = content_height - 90; // 55px -> Top Part | 35px -> Bottom Part
		
		setHeight('siteContent_cell', content_height);
		setHeight('siteContent_frame', content_height);
		
		setHeight('siteShadowConstruct_left_middle_div', shadow_height);
		setHeight('siteShadowConstruct_right_middle_div', shadow_height);
	}
}
function fitContentHeight()
{
	//alert("fitContentHeight ... \n    pageHeight: " + pageHeight() + "\n    subContentTitle Height: " + objHeight('subContentTitle') + "\n    query_dataVisContainer Height: " + objHeight('query_dataVisContainer'));
	
	var page_height = pageHeight();
	var content_height = page_height - objHeight('subContentTitle') - objHeight('query_dataVisContainer') - 4;
	
	setHeight('subContentConstruct_cell', page_height);
	setHeight('subContentConstruct_div', page_height);
	
	setHeight('subNavigation_cell', page_height);
	setHeight('subNavigation_div', page_height);
	
	setHeight('subContentFiltered_frame', content_height);
}
