// LoadBoxImg
// used @ nearly every page
// check parent-frame, src of titlepic & content of cbox
// if loaded into wrong frame, reload with correct framecontents
// arguments:
// - self	pagename of source
//
// elements of array 'pages'
// - each page's name is an element here. you add a page, you add an element to this array.
//   must be the same name, the page sends as the self variable
//
// elements of 'pages[?]' arrays
// - array[0]	the file loaded into -c-box
// - array[1]	the image displayed as 'titlepic'
// - array[2]	the framename of the frame the page should be loaded into
// - array[3]	the own filename

function LoadBoxImg(self) {
	// create an array with one element for each page
	pages = new Array(
		'home',
		'team',
		'angebot',
		'refsweb',
		'refscd',
		'refs',
		'contact',
		'jobs',
		'main',
		'clienthps',
		'clientkath',
		'clientbrc',
		'clienthptg'
		);
	
	// assign box-file, titlepic, the framename in which the page should be loaded
	// and own filename to the elements of 'pages' array
	pages['home'] = new Array(
		'news.html',
		'../clear.gif',
		'cstage',
		'home.htm'
		);
	
	pages['team'] = new Array(
		'box_team.html',
		'titel_team.gif',
		'cstage',
		'team.html'
		);
	
	pages['angebot'] = new Array(
		'box_angebot.html',
		'titel_angebot.gif',
		'cstage',
		'angebot.html'
		);
	
	pages['refsweb'] = new Array(
		'../box_referenzen.html',
		'titel_referenzen.gif',
		'cstage',
		'refs/ref_web.html'
		);
	
	pages['refscd'] = new Array(
		'box_ref_cd.html',
		'titel_referenzen.gif',
		'cstage',
		'refs/ref_cd.html'
		);
	
	pages['refs'] = new Array(
		'box_referenzen.html',
		'titel_referenzen.gif',
		'cstage',
		'referenzen.html'
		);
	
	pages['contact'] = new Array(
		'box_contact.html',
		'titel_kontakt.gif',
		'cstage',
		'contact.html'
		);
	
	pages['jobs'] = new Array(
		'box_jobs.html',
		'titel_jobs.gif',
		'cstage',
		'jobs.html'
		);
	
	pages['main'] = new Array(
		'',
		'',
		'chomepage',
		'home.htm'
		);
	
	pages['clienthps'] = new Array(
		'hps_logo.html',
		'../../pics/clear.gif',
		'cstage',
		'hps.html'
		);
		
	pages['clientkath'] = new Array(
		'kath_logo.html',
		'../../pics/clear.gif',
		'cstage',
		'kath.html'
		);
		
	pages['clientbrc'] = new Array(
		'brc_logo.html',
		'../../pics/clear.gif',
		'cstage',
		'brc.html'
		);
		
	pages['clienthptg'] = new Array(
		'hptg_box.html',
		'../../pics/clear.gif',
		'cstage',
		'hptg.html'
		);

	if(window.name !== pages[self][2]) {
		// if the page isn't loaded into the -c-stage, reload index.php and load
		// the page into -c-stage
		top.location = 'index.php?mf=' + pages[self][3];

	} else {
		// change bkg-pic if 'home' is loaded/unloaded
		if(self == 'home' || '') {
			top.chomepage.document.body.background = 'pics/bkg_home.gif';
		} else {
			top.chomepage.document.body.background = 'pics/bkg_main.gif';
		}
		// load titelpic
		top.chomepage.document.titelpic.src = 'pics/title/' + pages[self][1];
		
		// load box-file into cbox frame
		top.chomepage.frames.cbox.location = pages[self][0];

	}

}


// ClientPopup
// used @ pages from refs/clients
// loads a centered popup with details about the work for a client
// arguments:
// - target	page to load into popup, relative path from clientpage
// - width	popup width [optional, default = 650]
// - height	popup height [optional, default = 550]

function ClientPopup(target,width,height) {
	
	if(!width || width == 0) {
		var width = 650;
	}
	
	if(!height || height == 0) {
		var height = 600;
	}
	
	var newwin;
	var winHeight = (screen.availHeight - height)  / 2;
	var winWidth = (screen.availWidth - width)  / 2;
	var winSize = 'width=' + width + ',height=' + height + ',top=' + winHeight + ',left=' + winWidth;
	
	newwin = window.open(target, 'clientlarge', winSize + ',scrollbars=no,resizeable=no,menubar=no,toolbar=no,location=no,directories=no,status=no,copyhistory=no');

}

