// ::::::::::::::::::::::::::::::::::::::::::::::::::::: //
// ::::::::::::   Author: Torsten Naujoks   :::::::::::: //
// ::::::::::::      Gizmo: websmith.de     :::::::::::: //
// ::::::::::::    Release: Version 1.1     :::::::::::: //
// ::::::::::::       Datum: 30.01.09       :::::::::::: //
// :::::::::::  Copyrights: Torsten Naujoks  ::::::::::: //
// :::: Any use is prohibited by international law ::::: //
// ::::::::::::::::::::::::::::::::::::::::::::::::::::: //


// ::::::::::::::::::::::::::::::::::::::::::::::::::::: //
// 1. ENVIRONMENT-OBJECT & EXCLUSION OF BAD BROWSERS  :: //
// :: leaned on the everlasting environment script ::::: //
// :: of Thomas Brattli and Dan Steinman ::::::::::::::: //
// ::::::::::::::::::::::::::::::::::::::::::::::::::::: //

function Is(){
var agent		= navigator.userAgent.toLowerCase();
this.major		= parseInt(navigator.appVersion);
this.minor		= parseFloat(navigator.appVersion);
this.dom		= document.getElementById?1:0;
this.k			= (agent.indexOf('konqueror') != -1);
this.ko			= (this.k && Number(agent.substring(agent.indexOf('konqueror') + 10,agent.indexOf('konqueror') + 13)) > 3);
this.ns			= ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
this.ns0		= (this.ns && this.major < 5);
this.ns5		= (this.dom && this.ns && this.major == 5);
this.ff2		= ((agent.indexOf('firefox/2') != -1) || (agent.indexOf('seamonkey/1') != -1));
this.ff3		= (agent.indexOf('firefox/3') != -1);
this.ff35		= (agent.indexOf('firefox/3.5') != -1 || agent.indexOf('firefox/3.6') != -1);
this.safari		= (agent.indexOf('safari') != -1 || agent.indexOf('webkit') != -1);
this.ie			= (agent.indexOf('msie') != -1);
this.ie5		= (this.ie && agent.indexOf('msie 5') != -1);
this.ie6		= (this.ie && agent.indexOf('msie 6') != -1);
this.ie7		= (this.ie && agent.indexOf('msie 7') != -1)
this.ie8		= (this.ie && agent.indexOf('msie 8') != -1)
this.o			= (agent.indexOf('opera') != -1);
this.op			= (this.o && Number(agent.substring(agent.indexOf('opera') + 6,agent.indexOf('opera') + 9)) > 7);
this.mac		= (agent.indexOf('mac') != -1 || agent.indexOf('macppc') != -1 || agent.indexOf('mac_powerpc') != -1);
this.badmacie	= (this.mac && this.ie);
this.en			= ((this.safari || this.ns5 || this.ie8 || this.ie7 || this.ie6 || this.ie5 || this.op) && !this.badmacie);
}
var is = new Is();

if(!is.en || is.badmacie)self.location.href = 'no.html';
if(parent.frames.length > 0)top.location.replace('http://www.websmith.de');
if(self.location.href.indexOf('http://www.websmith.de') == -1)self.location.replace('http://www.websmith.de');


// ::::::::::::::::::::::::::::::::::::::::::::::::::::: //
// 2. CSS-INCLUDE BY ENVIRONMENT   ::::::::::::::::::::: //
// ::::::::::::::::::::::::::::::::::::::::::::::::::::: //

if(is.ie && !is.ie7 && !is.ie8){document.write('<LINK REL="STYLESHEET" TYPE="text/css" HREF="/sys/websmith_ie.css">')}
if(is.ie7 || is.ie8){document.write('<LINK REL="STYLESHEET" TYPE="text/css" HREF="/sys/websmith_ie7.css">')}
if(is.ns && !is.ff35 && !is.safari){document.write('<LINK REL="STYLESHEET" TYPE="text/css" HREF="/sys/websmith_ns.css">')}
if(is.ff35 || is.safari){document.write('<LINK REL="STYLESHEET" TYPE="text/css" HREF="/sys/websmith_ff35.css">')}
if(is.op){document.write('<LINK REL="STYLESHEET" TYPE="text/css" HREF="/sys/websmith_op.css">')}


// ::::::::::::::::::::::::::::::::::::::::::::::::::::: //
// 3. GLOBAL VARIABLES   ::::::::::::::::::::::::::::::: //
// ::::::::::::::::::::::::::::::::::::::::::::::::::::: //

i_ll = "http://websmith.de/";
i_am = window.location.href.substring(0,window.location.href.length).replace("www.","");

myFlapOffsets = new Array(200,180,180,180);
mywebsmithWindow = animatorTime = 0;
animator = 6;
myPrintContent = myWindowContent = '';
myContent = '<IMG SRC="/layout/wsd/window.gif" ALT="" HEIGHT="331" WIDTH="497" STYLE="position: absolute; top: 0px; left: 0px; cursor: default" onLoad="websmith(\'showContent\',\'windowShow\')">';
myContent += '<DIV ID="websmithWindowTitle"> </DIV>';
if(is.ie){
	myContent += '<IMG SRC="/layout/0.gif" ALT="" BORDER="0" HEIGHT="21" ID="websmithDrag" WIDTH="497" UNSELECTABLE="ON">';
	}
else{
	myContent += '<DIV ID="websmithDrag"><IMG SRC="/layout/0.gif" ALT="" BORDER="0" HEIGHT="21" WIDTH="1"></DIV>';
	}
myContent += '<DIV ID="print"><IMG SRC="/layout/wsd/print.gif" ALT="print.gif - 943 Bytes" TITLE="Diesen Artikel drucken - Printer friendly Version of this Article Window" HEIGHT="36" WIDTH="69" STYLE="cursor: pointer" onMouseOut="this.style.marginTop=0" onMouseOver="this.style.marginTop=-18" onClick="websmith(\'showContent\',\'windowPrint\')"></DIV>';
myContent += '<DIV ID="close"><IMG SRC="/layout/wsd/zu.gif" ALT="zu.gif - 1.037 Bytes" TITLE="Diesen Artikel schliessen - Close Article Window" HEIGHT="36" WIDTH="73" STYLE="cursor: pointer" onMouseOut="this.style.marginTop=0" onMouseOver="this.style.marginTop=-18" onClick="websmith(\'showContent\',\'windowHide\')"></DIV>';
myContent += '<DIV CLASS="websmithScr">$Inhalt<BR><BR></DIV>';


// ::::::::::::::::::::::::::::::::::::::::::::::::::::: //
// 4. THE BIG EASY   ::::::::::::::::::::::::::::::::::: //
// ::::::::::::::::::::::::::::::::::::::::::::::::::::: //

startMe = function(){
if(is.ie){
	flap = obj("nav");
	flap.parentNode.style.width = flap.offsetWidth;
	for(i = 0 ; i < obj("nav","elm","li").length ; i++){
		node = obj("nav","elm","li",i);
		node.onmouseover = function(){this.className += " over";}
		node.onmouseout = function(){this.className = this.className.replace(" over", "");}
		}
	}
websmith(0);
}

function websmith(arg1,arg2,arg3,arg4){
switch(arg1){
	case 0 :
		if(i_am != i_ll){
			obj('lo','col',0).firstChild.setAttribute("TITLE","Startseite");
			obj('loa').innerHTML = '<A HREF="/"><IMG SRC="/layout/logos/logo_head_ani.jpg" ALT="" BORDER="0" HEIGHT="4644" TITLE="Startseite" WIDTH="54" onLoad="websmith(\'animate\')"></A>';
			}
		else{
			obj('loa').innerHTML = '<DIV><IMG SRC="/layout/logos/logo_head_ani.jpg" ALT="" BORDER="0" HEIGHT="4644" TITLE="Animierte Logos - Logoanimationen ab 500 Euro" WIDTH="54" onLoad="websmith(\'animate\')"></DIV>';
			}
		if(i_am.indexOf(i_ll + 'webhosting/paket-') == 0 || (i_am.indexOf(i_ll + 'webspace-provider-isp/') == 0 && window.name == 'wsd'))websmith('wrapInline');
		if(i_am.indexOf(i_ll + 'webdesign/referenzen-3.html') == 0)websmith('wrapRef');
		if(obj('WCMS'))cms('init');
		websmith('dims');
	break;
	case 'dims' :
		if(is.ns){
			brH = self.innerHeight;
			brW = self.innerWidth;
			}
		if(is.ie || is.op){
			brH = document.body.clientHeight;
			brW = document.body.clientWidth;
			if(is.ie){
				if(!is.ie7 && elm('div')[0].parentNode.tagName == 'BODY' && elm('div')[0].parentNode.id != 'blog'){
					elm('div')[0].setAttribute('id','io');
					}
				if(obj('lo').nextSibling != null){
					elm('h1')[0].style.width = 486;
					}
				elm("table")[0].rows[4].cells[1].firstChild.style.width = 239;
				}
			}
		if(brW > 1280){
			elm('body')[0].style.marginLeft = (brW - 1240) / 2 + "px";
			elm('div')[0].style.width = "1240px";
			obj('menu').style.right = parseInt(((brW - 1240) / 2) + 112) + "px";
			obj('lo').style.marginLeft = parseInt(((brW - 1240) / 2) + (obj('lo').parentNode.offsetWidth / 100)) + "px";
			if(obj('lo').nextSibling != null){
				obj('lo').nextSibling.style.right = parseInt(((brW - 1240) / 2) + 112) + "px";
				}
			}
		else{
			elm('body')[0].style.marginLeft = "1%";
			elm('div')[0].style.width = "auto";
			obj('menu').style.right = "10%";
			obj('lo').style.marginLeft = "1%";
			if(obj('lo').nextSibling != null){
				obj('lo').nextSibling.style.right = "10%";
				}
			}
		if(obj('wrappo')){
			if(is.ns){
				obj('wrappo').firstChild.style.height = brH - obj('wrappo').offsetTop - 152;
				}
			else{
				if(is.ie){
					obj('wrappo').firstChild.style.height = obj('navbar').scrollHeight - obj('wrappo').offsetTop - 17;
					}
				if(is.op){
					obj('wrappo').firstChild.style.height = obj('navbar').scrollHeight - obj('wrappo').offsetTop - 2;
					}
				}
			}
	break;
	case 'wrapInline' :
		for(i = 0 ; i < elm('a').length ; i++){
			myCell = elm('a')[i].parentNode;
			if(myCell.innerHTML.toLowerCase().indexOf('/webspace-provider-isp/') != -1){
				myLink = myCell.innerHTML;
				myLink = myLink.replace('/webspace-provider-isp/','/cgi-bin/feature.cgi?f=');
				myCell.innerHTML = myLink;
				myLink = document.createAttribute("target");
				myLink.nodeValue = "wsd";
				myCell.firstChild.setAttributeNode(myLink);
				}
			}
	break;
	case 'wrapRef' :
		imr = document.getElementsByTagName('img');
		for(i = 0 ; i <	imr.length ; i++){
			if(imr[i].parentNode.className.search(/blogref|blog/) != -1){
				imt = imr[i].getAttribute('title');
				imr[i].parentNode.innerHTML = imr[i].parentNode.innerHTML.replace(/. <\/p>/i, '. <A HREF="http://www.' + imt.slice(imt.lastIndexOf(' ') + 1) + '" TARGET="_BLANK">&raquo; Zur ' + imt.slice(imt.indexOf(' ') + 1,imt.lastIndexOf(' ') + 1) + '</A></P>');
				if(!is.ie){
					imr[i].setAttribute('onclick','self.location.href = "http://www.' + imt.slice(imt.lastIndexOf(' ') + 1) + '"');
					}
				else{
					imr[i].outerHTML = imr[i].outerHTML.replace(/align/i,'onclick=self.location.href="http://www.' + imt.slice(imt.lastIndexOf(' ') + 1) + '" align');
					}
				imr[i].setAttribute('title','Zur ' + imt.slice(imt.indexOf(' ') + 1) + ' - externer Link');
				}
			}
	break;
	case 'animate' :
		if(animator < 86){
			obj('loa','col',0).firstChild.style.top = 0 - (animator * 54);
			animator++;
			animatorTime = setTimeout("websmith('animate')",35);
			}
		else{
			clearTimeout(animatorTime);
			obj('loa','col',0).style.top = 0;
			animator = 0;
			websmith('animate');
			}
	break;
	case 'showContent' :
		switch(arg2){
			case 'news' :
				obj('websmithNewsScr').innerHTML = arg3;
			break;
			case 'layout' :
				myWindowContent = myContent;
				if(websmith.arguments.length < 4){
					myPrintContent = arg3;
					myWindowContent = myWindowContent.replace('$Inhalt',arg3);
					}
				else{
					myPrintContent = arg4;
					myWindowContent = myWindowContent.replace('$Inhalt',arg4);
					}
				obj('websmithWindow').innerHTML = myWindowContent;
			break;
			case 'windowShow' :
				if(obj('websmithWindow').offsetTop == -350){
					obj('websmithWindow').style.left = brW - obj('websmithWindow').offsetWidth - 95;
					}
				obj('websmithWindow').style.top = elm('body')[0].scrollTop + 115;
			break;
			case 'windowHide' :
				obj('websmithWindow').style.top = -350;
				obj('websmithWindow').style.left = brW - obj('websmithWindow').offsetWidth - 95;
				mywebsmithWindow = 0;
			break;
			case 'windowPrint' :
				window.open('/print.html','websmithPrinter','top=12,left=12,width=640,height=440,resizable=0,scrollbars=1,toolbar=1,status=1');
			break;
			}
	break;
	case 'ccDrag' :
		switch(arg2){
			case 'drop' :
				if(ccDrag.parentNode.offsetLeft < 3){
					ccDrag.parentNode.style.left = 3;
					}
				if(ccDrag.parentNode.offsetLeft > brW - mySW - 20){
					ccDrag.parentNode.style.left = brW - mySW - 21;
					}
				if(ccDrag.parentNode.offsetTop < elm('body')[0].scrollTop + 3){
					ccDrag.parentNode.style.top = elm('body')[0].scrollTop + 3;
					}
				if(ccDrag.parentNode.offsetTop > elm('body')[0].scrollHeight - 348){
					ccDrag.parentNode.style.top = elm('body')[0].scrollHeight - 348;
					}
				document.onmousemove = null;
				document.onmouseup = null;
				if(is.ie || is.op)wsd.focus();
			break;
			case 'hide' :
				if(mywebsmithWindow == 1)websmith('showContent','windowHide');
			break;
			}
	break;
	}
}

function checkEvt(e){
if(is.ns){
	myY = e.pageY;
	myX = e.pageX;
	brH = self.innerHeight;
	brW = self.innerWidth;
	ccDrag = e.target;
	if(ccDrag == '[object Text]')ccDrag = e.target.parentNode;
	}
if(is.ie || is.op){
	myY = window.event.clientY;
	myX = window.event.clientX;
	brH = document.body.clientHeight;
	brW = document.body.clientWidth;
	ccDrag = window.event.srcElement;
	}
if(ccDrag.tagName == 'A')websmith('ccDrag','hide');
if(ccDrag.id == 'websmithDrag'){
	mySH = ccDrag.parentNode.offsetHeight;
	mySW = ccDrag.parentNode.offsetWidth;
	if(is.ns){
		oY = e.pageY - ccDrag.parentNode.offsetTop;
		oX = e.pageX - ccDrag.parentNode.offsetLeft;
		}
	if(is.ie || is.op){
		oY = window.event.clientY - ccDrag.parentNode.offsetTop;
		oX = window.event.clientX - ccDrag.parentNode.offsetLeft;
		}
	document.onmousemove = dragEvt;
	document.onmouseup = stopEvt;
	}
if(ccDrag.id == 'ProjektText' || ccDrag.id == 'ProjektUrl'){
	cms('trigger',ccDrag);
	}
return true;
}

function dragEvt(e){
if(is.ns){
	myY = e.pageY;
	myX = e.pageX;
	}
if(is.ie || is.op){
	myY = window.event.clientY;
	myX = window.event.clientX;
	}
ccDrag.parentNode.style.top = myY - oY;
ccDrag.parentNode.style.left = myX - oX;
if(ccDrag.parentNode.offsetLeft < 3 || ccDrag.parentNode.offsetLeft > brW - mySW - 20 || ccDrag.parentNode.offsetTop < elm('body')[0].scrollTop + 3 || ccDrag.parentNode.offsetTop > elm('body')[0].scrollHeight - 348){
	websmith('ccDrag','drop');
	}
return false;
}

function stopEvt(e){
websmith('ccDrag','drop');
return false;
}

function obj(){
if(arguments.length == 0){
	return;
	}
if(arguments.length == 1){
	return document.getElementById(arguments[0]);
	}
else if(arguments.length == 2){
	return obj(arguments[0]).childNodes;
	}
else{
	if(arguments[1] == 'col'){
		return obj(arguments[0]).childNodes[arguments[2]];
		}
	if(arguments[1] == 'elm'){
		if(arguments.length == 3){
			return obj(arguments[0]).getElementsByTagName(arguments[2]);
			}
		else{
			return obj(arguments[0]).getElementsByTagName(arguments[2])[arguments[3]];
			}
		}
	}
}

function elm(){
return document.getElementsByTagName(arguments[0]);
}

document.onmousedown = checkEvt;
window.onload = startMe;
window.onresize = function(){websmith('dims');};