/* Menüscript */

if (document.getElementsByTagName && document.getElementById) {
if (window.addEventListener) window.addEventListener('load', start, false);
else if (window.attachEvent) window.attachEvent('onload', start);
}


function start() {
prepareImageSwap('menue');
prepareImageSwap('footer');
bodylink();
}


/*Hooverbilder */
function prepareImageSwap(elem) {
	if (typeof(elem) == 'string') elem = document.getElementById(elem);
	if (elem == null) return;
	var regg = /(.*)(\.)([^\.]{3,4})$/
	var prel = new Array(), img, imgsrc, imgList, mtchd;
	imgList = elem.getElementsByTagName('img');
	for (var i=0; img = imgList[i]; i++) {
		if (!img.rolloverSet && img.src.match(regg) && elem.getElementsByTagName('img')[i].parentNode.tagName=="A") {
			mtchd = img.src.match(regg);
			img.hoverSRC = mtchd[1]+'o.'+ mtchd[3];
			img.outSRC = img.src;
			img.mdownSRC = mtchd[1]+'d.' + mtchd[3];
			preLoadImg(img.hoverSRC); img.onmouseover = imgHoverSwap;
			preLoadImg(img.outSRC); img.onmouseout = imgOutSwap;
			if (img.mdownSRC) {preLoadImg(img.mdownSRC); img.onmousedown = imgMouseDownSwap;}
			img.rolloverSet = true;
		}
	}

	function preLoadImg(imgSrc) {
		prel[prel.length] = new Image(); prel[prel.length-1].src = imgSrc;
	}

}

function imgHoverSwap() {this.src = this.hoverSRC;}
function imgOutSwap() {this.src = this.outSRC;}
function imgMouseDownSwap() {this.src = this.mdownSRC;}
function imgMouseUpSwap() {this.src = this.mupSRC;}
function MouseOver() {this.style.color = '#999999';}
function MouseOut() {this.style.color = 'black';}

function bodylink() {
	for (var i=0; temp = document.getElementsByTagName('P')[i]; i++){
		if(temp.className == 'bodylink'){
			temp.onmouseover = MouseOver;
			temp.onmouseout = MouseOut;
		}
	}
}

/*------------------------------------------------------------
	Document Text Sizer- Copyright 2003 - Taewook Kang.  All rights reserved.
	Coded by: Taewook Kang (txkang.REMOVETHIS@hotmail.com)
	Web Site: http://txkang.com
	Script featured on Dynamic Drive (http://www.dynamicdrive.com)
	
	Please retain this copyright notice in the script.
	License is granted to user to reuse this code on 
	their own website if, and only if, 
	this entire copyright notice is included.
--------------------------------------------------------------*/

//Specify affected tags. Add or remove from list:
var tgs = new Array( 'p');

//Specify spectrum of different font sizes:
var szs = new Array( '8px','10px','12px','medium','large','x-large','xx-large' );
var startSz = 2;

function ts( trgt,inc ) {
	if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 6 ) sz = 6;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
}

//Öffnen des Anfrageformulars in einem neuen Fenster
function anfrage(url) {
	if(!url) url = 'http://www.project-smooth.com/_site/kontakt_anfrage.php';
	temp = screen.availHeight - 80
	args = 'width=680,height='+temp+',status=no,scrollbars=yes,resizable=yes';
  ok = window.open(url,'',args);
  ok.moveTo(20,20);
  ok.focus();
  
  if (ok) return false;
  else return true;
}