var number_of_frontpics=24;

function showImg() {
	if(document.getElementById) {
		var num=1+Math.round(Math.random()*(number_of_frontpics-1));
		var picName="img"+num;
		var div=document.getElementById(picName);
		div.className='visibleImg';	
	}
}

function unscram() {
	if(document.getElementsByTagName) {
		var epoas = document.getElementsByTagName("span");
		for (var i=0; i<epoas.length; i++) {
			var epoa = epoas[i];
			if (epoa.className != "screma") continue;
			var content = epoa.innerHTML;
			var scrambled = content;
			var titleAttr = epoa.getAttribute("title");
			if (titleAttr)
			   scrambled = titleAttr;
			var unscrambled = scrambled.replace(/ hos /g, "@").replace(/ punkt /g, ".");
			if (!titleAttr)
				content = unscrambled;
			else
				epoa.setAttribute("title", unscrambled);
			epoa.innerHTML = '<a name="E-mail" href="mailto:' + unscrambled + '">' + content + '</a>';
		}
	}
}

function overmenucolor(m) {
	if(document.getElementById) {
	document.getElementById(m+'dot').style.color='#66CCFF';
	document.getElementById(m).style.color='#006699';
	}
}

function outmenucolor(m) {
	if(document.getElementById) {
	document.getElementById(m+'dot').style.color='#006699';
	document.getElementById(m).style.color='#333333';
	}
}

function setNewCSS(stylecss) {
	try {
		document.getElementsByTagName("head")[0].appendChild(stylecss);
		}
	catch (e) {
		setTimeout(function(){setNewCSS(stylecss)}, 100);
		}
}

function changeSize() {
	if (location.search.substring(1).indexOf("large")!=-1) {
		if(document.getElementsByTagName && document.getElementById) {
		/// Replacing css with large version ///
			var stylecss = document.createElement("link");
			stylecss.setAttribute("href","pplarge.css");
			stylecss.setAttribute("rel","stylesheet");
			stylecss.setAttribute("type","text/css");
			setNewCSS(stylecss);
			stylecss = null;
			
		/// Replacing all images with large version ///
			var pics = document.getElementsByTagName("img");		
			for (var k=0; k<pics.length; k++) {
				if(pics[k].getAttribute("name")=="hmainspacer") {
					if(detect.browser!="Safari")
						pics[k].setAttribute("height", Math.round(pics[k].getAttribute("height")*1.13));
					continue;
				}
				if(pics[k].getAttribute("name")=="wmainspacer") {
					if(detect.browser!="Safari")
						pics[k].setAttribute("width", Math.round(pics[k].getAttribute("width")*1.2));
					continue;
				}
				var picsrc=pics[k].getAttribute("src");
				if(picsrc.indexOf(".gif")!=-1)
					var pictype=".gif";
				else if(picsrc.indexOf(".jpg")!=-1)
					var pictype=".jpg";
				else
					var pictype=".png";
				var oldpicname=picsrc.substring(0, picsrc.length-4);		
				if (picsrc.substring(picsrc.length-9,picsrc.length)!="blank.gif")
					pics[k].setAttribute("src", oldpicname + "large" + pictype);
				if(pics[k].getAttribute("onmouseover"))
					if (pictype==".gif")
						pics[k].onmouseover=function(){this.src=this.src.substring(0, this.src.indexOf("large")) + "molarge.gif";};	
					else if (pictype==".jpg")
						pics[k].onmouseover=function(){this.src=this.src.substring(0, this.src.indexOf("large")) + "molarge.jpg";};	
					else
						pics[k].onmouseover=function(){this.src=this.src.substring(0, this.src.indexOf("large")) + "molarge.png";};	
				if(pics[k].getAttribute("onmouseout"))
					if (pictype==".gif")
						pics[k].onmouseout=function(){this.src=this.src.substring(0, this.src.indexOf("molarge")) + "large.gif";};			
					else if (pictype==".jpg")
						pics[k].onmouseout=function(){this.src=this.src.substring(0, this.src.indexOf("molarge")) + "large.jpg";};			
					else
						pics[k].onmouseout=function(){this.src=this.src.substring(0, this.src.indexOf("molarge")) + "large.png";};			
			}
			for (var j=0; j<5; j++){
				if(document.getElementById("fastlinkbox0"+j)) {
					document.getElementById("fastlinkbox0"+j).style.height="36px";
					document.getElementById("fastlinkbox0"+j).style.width="228px";
					document.getElementById("fastlinkbox0"+j).style.background="url(images/fastlinklarge.jpg)";
					document.getElementById("fastlinktxt0"+j).style.top="7px";
				}
			}
		/// Changing all links ///
			var links = document.getElementsByTagName("a");
			for (var m=0; m<links.length; m++)
				if (links[m].getAttribute("name")!="E-mail" && links[m].getAttribute("name")!="Logo")
					if (links[m].getAttribute("name")=="Textsize")
						links[m].setAttribute("href", links[m].getAttribute("href").substring(0, links[m].getAttribute("href").indexOf("?large")));				
					else links[m].setAttribute("href", links[m].getAttribute("href") + "?large");
						
		/// Adjusting size on iframes ///
			var frames = document.getElementsByTagName("iframe");
			for (var n=0; n<frames.length; n++) {
				frames[n].setAttribute("width", Math.round(frames[n].getAttribute("width")*1.2)+"px");
				frames[n].setAttribute("height", Math.round(frames[n].getAttribute("height")*1.2)+"px");
			}
		}
		else alert("This function is not available for your browser.");
	}
}
