/* ------------ Config ------------- */
document.scrollTextLeft									=	-600;
document.endScrollLeft									=	0;
document.img1											=	{}
document.img2											=	{}
document.txt1											=	{}
document.currObj										=	[];
document.currWin										=	null;
/* ------------ Functions ------------- */

var init												=	function()
{
	document.getElementsByTagName('body')[0].style.visibility='visible';
	$('doc').setStyle(
		{
			overflow	:		'',
			overflowY	:		'auto',
			overflowX	:		'hidden'
		}
	);
	if(document.IE || document.IE7){
		$('doc').setStyle(
			{
				width							:	(parseFloat(Element.getStyle('doc','width'))-8) + 'px',
				paddingRight					:	(parseFloat(Element.getStyle('doc','padding-right'))+10) + 'px',
				scrollbarArrowColor				:	'#00873B',
				scrollbarDarkShadowColor		:	'#F7F7EB',
				scrollbarFaceColor				:	'#F7F7EB',
				scrollbarHighlightColor			:	'#E3EFCB',
				scrollbarShadowColor			:	'#00873B',
				scrollbarTrackColor				:	'#E3EFCB'
			}
		);
	}
	var a 												=	$$('a');
	a.each(
		function(Value)
		{
		if((Value.href.indexOf('mail@kruegel-umzuege.php') > -1) && ((Value.firstChild.data=='mail@kruegel-umzuege.php') || (Value.firstChild.data=='e-mail'))){
			Value.href='mailto:info@kruegel-umzuege.de?Subject=Nachricht vom Kontaktfromular der Kruegel-Umzuege GmbH';
			Value.firstChild.data = Value.firstChild.data == 'mail@kruegel-umzuege.php' ? 'info@kruegel-umzuege.de' : Value.firstChild.data.replace('?Subject=Nachricht vom Kontaktfromular der Kruegel-Umzuege GmbH','');
		}
		// http://www.tomislav.net/gestrichelte-linie-um-link-verstecken.htm
		Value.onmousedown								=	function()
			{
				this.onfocus							=	function()
					{
						this.blur();
					}
			}
		Value.onmousemove								=	function()
			{
				this.onfocus							=	null;
			}
		Value.onmouseout								=	function()
			{
				this.onfocus							=	null;
			}
			if(Value.id == 'anzeige'){
				Value.onclick = function()
				{
					return wopen('http://www.kruegel-umzuege.de/Anzeige.html',510,250);
				}
			}
			if(Value.id.indexOf('formular') > -1){
				Value.onclick = function()
				{
					return wopen('http://www.kruegel-umzuege.de/Formular.php',576,500,'scrollbars=yes');
				}
			}
			if(document.IE7 && Value.className == 'hover') {
				Value.style.visibility = 'visible';
			}
		}
	);
	document.currObj[0]									=	$('lauftext');
	document.endScrollLeft								=	(608 - document.currObj[0].getWidth());
	new PeriodicalExecuter(scrollHeadline, .05);
}

var scrollHeadline										=	function(Tmr)
{
	document.scrollTextLeft								+=30;
	document.currObj[0].style.visibility				=	'visible';
	document.currObj[0].style.left						=	document.scrollTextLeft + 'px';
	if(document.scrollTextLeft >= document.endScrollLeft){
		document.currObj[0].style.left					=	document.endScrollLeft + 'px';
		Tmr.stop();
		if(document.currObj[0] = $('pic1C')){
			document.currObj[1]							=	$('pic1D');
			document.img1								=	document.currObj[0].getDimensions();
			document.img1.newHeight						=	1;
			document.currObj[1].makeClipping().setStyle({width: document.img1.width + 'px', height: document.img1.newHeight + 'px'});
			document.currObj[1].style.visibility		=	'visible';
			if(document.currObj[2] = $('pic2C')){
				document.currObj[3]							=	$('pic2D');
				document.img2								=	document.currObj[2].getDimensions();
				document.img2.newHeight						=	1;
				document.currObj[3].makeClipping().setStyle({width: document.img2.width + 'px', height: document.img2.newHeight + 'px'});
				document.currObj[3].style.visibility		=	'visible';
				new PeriodicalExecuter(scrollPic2, .02);		
			}
			else{
				new PeriodicalExecuter(scrollPic, .02);
			}
		}
	}
}

var scrollPic											=	function(Tmr)
{
	document.img1.newHeight								+=15;
	if(document.img1.newHeight < document.img1.height){
		document.currObj[1].makeClipping().setStyle({width: document.img1.width + 'px', height: document.img1.newHeight + 'px'});
	}
	else{
		document.currObj[1].makeClipping().setStyle({width: document.img1.width + 'px', height: document.img1.height + 'px'});
		Tmr.stop();
		document.currObj[0]								=	$('outerDoc');
		document.txt1									=	document.currObj[0].getDimensions();
		document.txt1.newWidth							=	1;
		document.currObj[0].makeClipping().setStyle({width: document.txt1.newWidth + 'px', height: document.txt1.height + 'px'});
		document.currObj[0].style.visibility			=	'visible';
		new PeriodicalExecuter(scrollText, .02);
	}
}
var scrollPic2											=	function(Tmr)
{
	document.img1.newHeight								+=15;
	if(document.img1.newHeight < document.img1.height){
		document.currObj[1].makeClipping().setStyle({width: document.img1.width + 'px', height: document.img1.newHeight + 'px'});
	}
	else{
		document.currObj[1].makeClipping().setStyle({width: document.img1.width + 'px', height: document.img1.height + 'px'});
	}
	if(document.img1.newHeight > (document.img1.height / 1.2)){
		document.img2.newHeight							+=15;
		if(document.img2.newHeight < document.img2.height){
			document.currObj[3].makeClipping().setStyle({width: document.img2.width + 'px', height: document.img2.newHeight + 'px'});
		}
		else{
			document.currObj[3].makeClipping().setStyle({width: document.img2.width + 'px', height: document.img2.height + 'px'});
			Tmr.stop();
			document.currObj[0]							=	$('outerDoc');
			document.txt1								=	document.currObj[0].getDimensions();
			document.txt1.newWidth						=	1;
			document.currObj[0].makeClipping().setStyle({width: document.txt1.newWidth + 'px', height: document.txt1.height + 'px'});
			document.currObj[0].style.visibility		=	'visible';
			new PeriodicalExecuter(scrollText, .02);
		}
	}
}

var scrollText											=	function(Tmr)
{
	document.txt1.newWidth								+=25;
	if(document.txt1.newWidth < document.txt1.width){
		document.currObj[0].makeClipping().setStyle({width: document.txt1.newWidth + 'px', height: document.txt1.height + 'px'});
	}
	else{
		document.currObj[0].makeClipping().setStyle({width: document.txt1.width + 'px', height: document.txt1.height + 'px'});
		document.currObj[0].style.overflow				=	'auto';
		Tmr.stop();
	}
}

function postValues(Act,Name,Value){
	var Form = makeForm(Act);
	makeHiddenField(Form,Name,Value);
	Form.submit();
}


function makeForm(Act,Targ){
	var frmElem=document.createElement('form');
	var myForm=document.getElementsByTagName('body')[0].appendChild(frmElem);
	myForm.action=Act;
	myForm.method='post';
	return myForm;
}

function makeHiddenField(Form,Name,Value){
	var myHidd=Form.appendChild((document.IE || document.IE7)?document.createElement('<INPUT TYPE=HIDDEN />'):document.createElement('input'));
	if(!document.IE && !document.IE7){
		myHidd.setAttribute('type','hidden');
	}
	myHidd.id=Name;
	myHidd.name=Name;
	myHidd.value=Value;
}
var wopen 									=	function(Url, Width, Height, Features)
{
	if(document.currWin){
		document.currWin.close();
	}
	document.currWin = window.open(Url,'Popup','width=' + Width + ',height=' + Height + ',top=20,left=20' + (Features?(','+Features):''));
	if(document.currWin){
		document.currWin.focus();
		return false;
	}
	else{
		return true;
	}
}
window.onunload = function()
{
	if(document.currWin){
		document.currWin.close();
	}
}
window.onload=init;