﻿// ==========================================
//	v3.6, singlepage
//	diverse CMS Standard JavaScript-Funktionen
// ==========================================

/*
	31.01.2009, dogan

	©2009 Tanyel Dogan, alle Rechte vorbehalten
*/
function cms4d_write_flash(movie_src
							,f_objid
							,f_width
							,f_height
							,f_align
							,f_allow_script_access
							,f_loop
							,f_menu
							,f_quality
							,f_scale
							,f_salign
							,f_wmode
							,f_bgcolor
							,version_str)
{
	var src = movie_src;
	var t = '';
t += '<object';
t += '\n classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
t += '\n codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version_str + '"';
t += '\n width="' + f_width + '"';
t += '\n height="' + f_height + '"';
t += '\n id="' + f_objid + '"';
t += '\n align="' + f_align + '">\n';
t += '\t<param name="allowScriptAccess" value="' + f_allow_script_access + '"/>\n';
t += '\t<param name="movie" value="' + src + '"/>\n';
t += '\t<param name="loop" value="' + f_loop + '"/>\n';
t += '\t<param name="menu" value="' + f_menu + '"/>\n';
t += '\t<param name="quality" value="' + f_quality + '"/>\n';
t += '\t<param name="scale" value="' + f_scale + '"/>\n';
t += '\t<param name="salign" value="' + f_salign + '"/>\n';
t += '\t<param name="wmode" value="' + f_wmode + '"/>\n';
t += '\t<param name="bgcolor" value="' + f_bgcolor + '"/>\n';
	t += '\t<embed src="' + src + '"';
	t += '\n loop="' + f_loop + '"';
	t += '\n menu="' + f_menu + '"';
	t += '\n quality="' + f_quality + '"';
	t += '\n scale="' + f_scale + '"';
	t += '\n salign="' + f_salign + '"';
	t += '\n wmode="' + f_wmode + '"';
	t += '\n bgcolor="' + f_bgcolor + '"';
	t += '\n width="' + f_width + '"';
	t += '\n height="' + f_height + '"';
	t += '\n name="' + f_objid + '"';
	t += '\n align="' + f_align + '"';
	t += '\n allowScriptAccess="' + f_allow_script_access + '"';
	t += '\n type="application/x-shockwave-flash"';
	t += '\n pluginspage="http://www.macromedia.com/go/getflashplayer"/>\n';
t += '</object>';
//alert(t);
document.write(t);
}


//--------- FLASH-Player per JS einbinden ---------
function write_player_8(player_src, player_width, player_height, bgcolor)
{
	var t = '';
	t += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + player_width + '" height="' + player_height + '" id="cms4d_flv_videoplayer_2007" align="middle">\n';
	t += '<param name="allowScriptAccess" value="sameDomain" />\n';
	t += '<param name="movie" value="' + player_src + '" />\n';
	t += '<param name="loop" value="false" />\n';
	t += '<param name="menu" value="false" />\n';
	t += '<param name="quality" value="high" />\n';
	t += '<param name="scale" value="noscale" />\n';
	t += '<param name="salign" value="lt" />\n';
	t += '<param name="bgcolor" value="' + bgcolor + '" />\n';
	t += '<embed src="' + player_src + '" loop="false" menu="false" quality="high" scale="noscale" salign="lt" bgcolor="' + bgcolor + '" width="' + player_width + '" height="' + player_height + '" name="cms4d_flv_videoplayer_2007" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
	t += '</object>\n';
//alert(t);
	document.writeln(t);
}


//------------- Standard neues Fenster öffnen ------------
function neuwindow(fenstername, url, w, h, status_flag, resize_flag, scroll_flag)
{
	var aw = screen.availWidth;
	var ah = screen.availHeight;
	if(w == null || h == null)
	{
		wb = screen.availWidth - 100;
		wh = screen.availHeight - 100;
	}
	else
	{
		wb = w;
		wh = h;
	}
	var wx = (aw / 2) - (wb / 2) - 6;
	var wy = (ah / 2) - (wh / 2) - 30;

	var status_enable = 1;
	if(status_flag != null)status_enable = status_flag;
	var scroll_enable = 1;
	if(scroll_flag != null)scroll_enable = scroll_flag;
	var resize_enable = 1;
	if(resize_flag != null)resize_enable = resize_flag;

	var fenster = window.open(url,fenstername,'toolbar=0,location=0,directories=0,status=' + status_enable + ',menubar=0,scrollbars=' + scroll_enable + ',resizable=' + resize_enable + ',Width=' + wb + ',height=' + wh + ',left=' + wx + ',top=' + wy);
	//return(fenster);
}



//------- Bild Zoomfunktion ----------
//Veraltet. Aus Gründen der Rückwärtskompatibilität vor v1.6 beibehalten !
function zoomwindow(url) 
{
	var wb = 300;
	var wh = 300;
	var sx = screen.width;
	var sy = screen.height;
	var wx = (sx / 2) - (wb / 2);
	var wy = (sy / 2) - (wh / 2);

	//WICHTIG: das window MUSS resizeable sein, da sonst Netscape 4.x
	//die Grösse nachträglich nicht ändern kann !

	zoomwin=window.open(url,'Zoom',"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,WIDTH=" + wb + ",HEIGHT=" + wh + ",left=0,top=0,left=" + wx + ",top=" + wy)
	zoomwin.focus();
}
//ab v3.6
/*
function zoom(id)
{
	var url = 'cmszoom.asp?id=' + id;
	//WICHTIG: BasisURL der aufrufenden Seite einbeziehen.
	if(page_baseurl)
	{
		url = page_baseurl + url;
	}
	zoomwindow(url);
}
*/

function change_css1(obj,c)
{
	obj.className = c + '_on';
}

function change_css2(obj,c)
{
	obj.className = c;
}




//Für Aktionen Startseite
var aktionen = null;
var auto_ai_aktiv = 1;
var auto_ai_interval = null;
var auto_ai_pos = 0;

function ai(id,auto)
{
	var obj = null;
	var d_nodes = null;
	var i_nodes = null;
	var i = 0;
	var i2 = 0;

	if(auto == 0) auto_ai_aktiv = 0;


	var navi = document.getElementById('aktionen_navi');
	if(navi == null) return;


	//Große Bilder einblenden/ausblenden
	var img = document.getElementById('aktionen_img');
	if(img != null)
	{
		d_nodes = img.childNodes;
		for(i = 0; d_nodes.length > i; i++)
		{
			if(d_nodes[i].nodeName == 'IMG')
			{
				d_nodes[i].style.display = 'none';
			}
			if(d_nodes[i].nodeName == 'DIV')
			{
				d_nodes[i].style.display = 'none';
			}
		}

		obj = document.getElementById('img_' + id);
		if(obj != null)	obj.style.display = 'block';

		obj = document.getElementById('title_' + id);
		if(obj != null)	obj.style.display = 'block';
	}


	//Info-Container einblenden/ausblenden
	d_nodes = navi.childNodes;
	for(i = 0; d_nodes.length > i; i++)
	{
		if(d_nodes[i].nodeName == 'DIV')
		{
			d_nodes[i].style.display = 'none';
		}
		if(d_nodes[i].nodeName == 'A' && d_nodes[i].className == 'sc_thumb sc_thumb_on')
		{
			d_nodes[i].className = 'sc_thumb';
		}
	}


	obj = document.getElementById('info_' + id);
	if(obj != null)	obj.style.display = 'block';

	obj = document.getElementById('bt_' + id);
	if(obj != null)	obj.className = 'sc_thumb sc_thumb_on';
}

function aimg(news_id,img_id,img_size,img_pos)
{
	auto_ai_aktiv = 0;

	var obj = null;
	var img_obj = null;

	obj = document.getElementById('img_' + news_id);
	if(obj != null)
	{
		//obj.src = 'cmsimage.asp?id=' + img_id + '&size=' + img_size;
		obj.src = 'css/images-streif/loading.gif';
		obj.style.margin = '166px 0px 0px 306px';

		img_obj = new Image();
		img_obj.src= 'cmsimage.asp?id=' + img_id + '&size=' + img_size;
		img_obj.onLoad = img_loaded(obj,img_obj);
	}

	for(var i = 1; i < 7; i++)
	{
		obj = document.getElementById('thumb_img_' + news_id + '_' + i);
		if(obj != null) obj.style.border = '1px solid white';
	}


	obj = document.getElementById('thumb_img_' + news_id + '_' + img_pos);
	if(obj != null)
	{
		obj.style.border = '1px solid red';
	}

}

function img_loaded(obj,img_obj)
{
	obj.src = img_obj.src;
	obj.style.margin = '0';
}

function auto_ai()
{
	if(auto_ai_aktiv == 1)
	{
		auto_ai_pos = auto_ai_pos + 1;
		if((auto_ai_pos + 1) > aktionen.length) auto_ai_pos = 0;

		ai(aktionen[auto_ai_pos].substr(3),1);
	}
	else
	{
		window.clearInterval(auto_ai_interval);
	}
}

function auto_ai_start()
{
	aktionen = new Array();

	var obj = null;
	var d_nodes = null;
	var counter = 0;

	var navi = document.getElementById('aktionen_navi');
	if(navi == null) return;

	d_nodes = navi.childNodes;
	for(i = 0; d_nodes.length > i; i++)
	{
		if(d_nodes[i].nodeName == 'A')
		{
			aktionen[counter] = d_nodes[i].id;
			counter = counter + 1;
		}
	}

	auto_ai_interval = window.setInterval('auto_ai()', 6000);
}

function au(url,tgt)
{
	if(tgt == 1)
	{
		window.open(url);
	}
	else
	{
		document.location.href = page_baseurl + url;
	}
}


//---
