// declare is, needed for browser sniffing
if (!is) { is = {}; }


addLoadEvent( function() {

//	styleTables.createOddEven('striped');
//	teva.adjustHeight();
//	printReferences.create();
});



var teva = {
	idNSection: 'navSection',
	idCMain: 'contentMain',
	idCService: 'contentService',
	
	cnFnSup: 'printSup',
	
	baseUrl: 'http://teva-deutschland.de',
	//flashPath: 'http://tevat3.projekte.gpm.de/',
	flashPath: '/',

			
	adjustHeight:function() {
		var elNavSection = document.getElementById(teva.idNSection);
		var elContentMain = document.getElementById(teva.idCMain);
		var elContentService= document.getElementById(teva.idCService);
		var result = (elContentMain.offsetHeight > elContentService.offsetHeight) ? elContentMain.offsetHeight : elContentService.offsetHeight;
		if (elNavSection) { var result = (result > elNavSection.offsetHeight) ? result : elNavSection.offsetHeight; }
		elContentMain.style.height = result+'px';
		elContentService.style.height = result+'px';
	},
	
	// replaces preview image with swf-file
	flash:function (which,me,height,width)
	{

		// parent 
		var p = me.parentNode;

		// swf vars
		var swf = this.flashPath+which+'.swf';
		var height = height || 306;
		var width = width || 352;

		// crappy ie doesn't stick to the rules, feed innerHTML
		if (is.ie) {
			var _tmp = document.createElement('div');
			_tmp.innerHTML = '<object width="'+width+'" height="'+height+'" id="'+which+'object" type="application/x-shockwave-flash" data="'+swf+'"><param id="'+which+'param" name="movie" value="'+swf+'"/></object>';
			p.innerHTML = '';
			window.setTimeout(function() {p.appendChild(_tmp);},100); // due to sts
 			return;
		}

		// create elements
		var genDiv = document.createElement('div');
		genDiv.HTMLElement='div';
		genDiv.id = which+'Div';
		genDiv.className = 'vodcast';

		var genObject =  utility.createHTMLElement('object');
		genObject.id = which+'Object';
		genObject.type = 'application/x-shockwave-flash';
		genObject.data = swf;
		genObject.width = width;
		genObject.height = height;
			
		var genParam =  utility.createHTMLElement('param');
		genParam.id = which+'Param';
		genParam.name = 'movie';
		genParam.value = swf;

		/*
		var el = {};
		el.HTMLElement='div';
		el.id = which+el.HTMLElement;
		el.className = 'vodcast';
		var genDiv =  utility.createHTMLElement(el);

		var el = {};
		el.HTMLElement='object';
		el.id = which+el.HTMLElement;
		el.type = 'application/x-shockwave-flash';
		el.data = swf;
		el.width = '352';
		el.height = height;
		var genObject =  utility.createHTMLElement(el);
			
		var el = {};
		el.HTMLElement='param';
		el.id = which+el.HTMLElement;
		el.name = 'movie';
		el.value = swf;
		var genParam =  utility.createHTMLElement(el);
		*/
		
		// append them
		genObject.appendChild(genParam);
		// replace img
		p.replaceChild(genObject,me)
	},
	

	misc:function(){
	}
}

//addLoadEvent(teva.createReferences)

// inarray
Array.prototype.inArray = function(_v) {
	var _n = this.length;
	if (_n > 0) 
	{
		do 
		{
			if (this[_n] === _v) { return _n; }
		} 
		while (_n--);
	}
	return false;
}

// prototype stuff
// strstr, test for given substring
String.prototype.strstr = function(str) {
	return !!this.match("\\b"+str+"\\b");
}


// create utility functions 
function utility () {}
utility.prototype.createHTMLElement = function (_el,_id,_cn) {
		switch (typeof(_el))
		{
			case 'object':
				var nEl = document.createElement(_el.HTMLElement);
				for ( var i in _el) {
					if ( i == 'HTMLElement' ) { continue; }
					nEl[i] = _el[i];
				}
				return nEl;
			break;
		case 'string':
				_el = _el || 'div';
				var nEl = document.createElement(_el);
				nEl.id = (_id) ? _id : null;
				nEl.className = (_cn) ? _cn : null;
				return nEl;
			break;
		}
}
var utility = new utility();

function addLoadEvent(func) 
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} 
	else 
	{
		window.onload = function() 
		{
			if (oldonload) 
			{
				oldonload();
			}
			func();
		}
	}
}
