﻿var c1;
var c2;
var lang="_de";

function navHi(obj,s){
	//obj = obj.getElementsByTagName('div')[0];
	if(s == 'over'){
		//if(obj.id == "c4" && c1 != 4){
		//	document.getElementById('bwa_thing').style.visibility = 'visible';
		//}	
		document.body.style.cursor = 'pointer';
		obj.style.opacity = 0.7;
		obj.style.filter = 'alpha(opacity=70)';

	}
	if(s == 'out'){
		//if(obj.id == "c4"){
		//	document.getElementById('bwa_thing').style.visibility = 'hidden';
		//}	
		document.body.style.cursor = 'auto';
		obj.style.opacity = 1;
		obj.style.filter = 'alpha(opacity=100)';
	}
	if(s == 'click'){
		if(obj.id == "c5"){
			document.location.href = obj.id + '01' + lang + '.php';
		}
		if(obj.id == "c6"){
			document.location.href = obj.id + '01' + lang + '.php';
		}
		else{
			document.location.href = obj.id + '00' + lang + '.php';
		}
	}
}

function subHi(obj,s){
	if(s == 'over'){	
		if(obj.id == ('s'+c2)){
			document.body.style.cursor = 'default';
		}
		else{
		document.body.style.cursor = 'pointer';
		obj.style.color = '#909090';
		}

	}
	if(s == 'out'){
		if(obj.id == ('s'+c2)){
			document.body.style.cursor = 'auto';
		}
		else{
		document.body.style.cursor = 'auto';
		obj.style.color = '#B2B3B4';
		}
	}
	if(s == 'click'){
		document.location.href = 'c' + c1 + '0' + obj.id.substr(1) + lang + '.php';
	}

}

function nav(n1,n2,la){
	
	/*
	!!! Die Links zu kontakt und Fahrradparker wurden Google-konform mit a-Tags und den dazugehörenden href umgesetzt
	Bitte auf jeden Fall vorrübergehend so belassen !!! Uwe Mosgallik @ FAIRRANK
	*/
	
	lang = la;
	if(lang == '_de'){
	var out = '<div id="bwa_thing"><img src="images/bwa_thing.gif" alt="" height="40" width="119" border="0"></div><table width="100%" border="0" cellspacing="0" cellpadding="0" height="31">\
					<tr>\
						<td><img src="images/blank.gif" alt="" height="31" width="31" border="0"></td>\
						<td></td>\
					</tr>\
				</table>\
				<table width="100%" border="0" cellspacing="0" cellpadding="0">\
					<tr>\
						<td align="left" valign="top" style="padding-top:26px"><img src="images/logo_typo.gif" alt="" height="13" width="230" border="0"></td>\
						<td align="right"><a href="c000_de.php#/Startseite"><img src="images/logo_gif.gif" alt="" height="44" width="273" border="0"></a></td>\
					</tr>\
				</table>\
				<br>\
				<br>\
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="top_nav">\
					<tr>\
						<td>\
							<table width="130" border="0" cellspacing="0" cellpadding="0" class="search_frame">\
								<tr>\
									<td><form action="search' + la + '.php" method="post" style="margin:0px;"><input type="text" name="needle" value="Suchbegriff" size="24" class="search_input" onFocus="this.value = \'\'"></form></td>\
									<td style="padding-right: 5px; padding-left: 5px" width="4" onmouseover="document.body.style.cursor=\'pointer\'\" onmouseout="document.body.style.cursor=\'auto\'\" onclick="document.forms[0].submit()"><a href="javascript:document.forms[0].submit()"><img src="images/search_arrow.gif" alt="" height="7" width="4" border="0"></a></td>\
								</tr>\
							</table>\
						</td>\
						<td align="right" width="100"><a href="javascript:navClick(\'c000\')">home</a></td>\
						<td align="right" width="50"><a href="c701_de.php">kontakt</a></td>\
						<td align="right" width="145"><strong><font color="#d2222a">i</font></strong> +49 (0)89 / 670 10 15</td>\
						<td align="right" width="50"><a href="javascript:langToggle()"><img src="images/lang_de.gif" alt="" height="13" width="40" border="0"></a></td>\
					</tr>\
				</table>\
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="nav" bgcolor="white">\
					<tr>\
						<td id="c1" bgcolor="#f7931d" width="120" onclick="navHi(this,\'click\')" onmouseover="navHi(this,\'over\')" onmouseout="navHi(this,\'out\')"><a href="c100_de.php" style="color:#fff;">Fahrradständer</a></td>\
						<td id="c2" bgcolor="#d2222a" width="120" onclick="navHi(this,\'click\')" onmouseover="navHi(this,\'over\')" onmouseout="navHi(this,\'out\')">Überdachungen</td>\
						<td id="c3" bgcolor="#b7b142" width="110" onclick="navHi(this,\'click\')" onmouseover="navHi(this,\'over\')" onmouseout="navHi(this,\'out\')">Stadtmobiliar</td>\
						<td id="c4" bgcolor="black" width="110" onclick="navHi(this,\'click\')" onmouseover="navHi(this,\'over\')" onmouseout="navHi(this,\'out\')">bwa bausystem</td>\
						<td id="c5" bgcolor="#bdc1c2" width="90" onclick="navHi(this,\'click\')" onmouseover="navHi(this,\'over\')" onmouseout="navHi(this,\'out\')">Unternehmen</td>\
						<td id="c6" bgcolor="#bdc1c2" onclick="navHi(this,\'click\')" onmouseover="navHi(this,\'over\')" onmouseout="navHi(this,\'out\')">Service</td>\
					</tr>\
				</table>\
				<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#afb0b3" style="margin-top: 1px">\
					<tr>\
						<td><img src="images/blank.gif" alt="" height="1" width="10" border="0" /></td>\
					</tr>\
				</table>\
				<table width="100%" height="110" border="0" cellspacing="0" cellpadding="0">\
						<tr>\
							<td align="left" valign="top" width="130"><div id="sub1"><img src="images/nav_hi_1.gif" alt="" height="9" width="38" border="0"></div></td>\
							<td align="left" valign="top" width="130"><div id="sub2"><img src="images/nav_hi_2.gif" alt="" height="9" width="38" border="0"></div></td>\
							<td align="left" valign="top" width="120"><div id="sub3"><img src="images/nav_hi_3.gif" alt="" height="9" width="39" border="0"></div></td>\
							<td align="left" valign="top" width="120"><div id="sub4"><img src="images/bwa_thing.gif" alt="" height="40" width="119" border="0"></div></td>\
							<td align="left" valign="top" width="100"><div id="sub5">\
								<table width="100%" border="0" cellspacing="0" cellpadding="0" class="sub_nav">\
									<tr>\
										<td id="s1" class="sub_item" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">profil</td>\
									</tr>\
									<tr>\
										<td id="s2" class="sub_item" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">partner</td>\
									</tr>\
									<tr>\
										<td id="s3" class="sub_item" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">aktuelle projekte</td>\
									</tr>\
									<tr>\
										<td id="s4" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">referenzen</td>\
									</tr>\
								</table>\
								</div>\
							</td>\
							<td align="left" valign="top"><div id="sub6">\
								<table width="100%" border="0" cellspacing="0" cellpadding="0" class="sub_nav">\
									<tr>\
										<td id="s1" class="sub_item" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">planung</td>\
									</tr>\
									<tr>\
										<td id="s2" class="sub_item" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">montageservice</td>\
									</tr>\
									<tr>\
										<td id="s3" class="sub_item" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">metalbau / schweisstechnik</td>\
									</tr>\
									<tr>\
										<td id="s4" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">lieferservice</td>\
									</tr>\
								</table>\
								</div>\
							</td>\
						</tr>\
					</table>';
	}
	if(lang == '_en'){
			var out = '<div id="bwa_thing"><img src="images/bwa_thing.gif" alt="" height="40" width="119" border="0"></div><table width="100%" border="0" cellspacing="0" cellpadding="0" height="31">\
					<tr>\
						<td><img src="images/blank.gif" alt="" height="31" width="31" border="0"></td>\
						<td></td>\
					</tr>\
				</table>\
				<table width="100%" border="0" cellspacing="0" cellpadding="0">\
					<tr>\
						<td align="left" valign="top" style="padding-top:26px"><img src="images/logo_typo.gif" alt="" height="13" width="230" border="0"></td>\
						<td align="right"><a href="javascript:navClick(\'c000\')"><img src="images/logo_gif.gif" alt="" height="44" width="273" border="0"></a></td>\
					</tr>\
				</table>\
				<br>\
				<br>\
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="top_nav">\
					<tr>\
						<td>\
							<table width="130" border="0" cellspacing="0" cellpadding="0" class="search_frame">\
								<tr>\
									<td><form action="search' + la + '.php" method="post" style="margin:0px;"><input type="text" name="needle" value="Search" size="24" class="search_input" onFocus="this.value = \'\'"></form></td>\
									<td style="padding-right: 5px; padding-left: 5px" width="4" onmouseover="document.body.style.cursor=\'pointer\'\" onmouseout="document.body.style.cursor=\'auto\'\" onclick="document.forms[0].submit()"><a href="javascript:document.forms[0].submit()"><img src="images/search_arrow.gif" alt="" height="7" width="4" border="0"></a></td>\
								</tr>\
							</table>\
						</td>\
						<td align="right" width="100"><a href="javascript:navClick(\'c000\')">home</a></td>\
						<td align="right" width="50"><a href="javascript:navClick(\'c701\'\)">contact</a></td>\
						<td align="right" width="145"><strong><font color="#d2222a">i</font></strong> +49 (0)89 / 670 10 15</td>\
						<td align="right" width="50"><a href="javascript:langToggle()"><img src="images/lang_en.gif" alt="" height="13" width="40" border="0"></a></td>\
					</tr>\
				</table>\
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="nav" bgcolor="white">\
					<tr>\
						<td id="c1" bgcolor="#f7931d" width="120" onclick="navHi(this,\'click\')" onmouseover="navHi(this,\'over\')" onmouseout="navHi(this,\'out\')">Bike Stands</td>\
						<td id="c2" bgcolor="#d2222a" width="120" onclick="navHi(this,\'click\')" onmouseover="navHi(this,\'over\')" onmouseout="navHi(this,\'out\')">Shelters</td>\
						<td id="c3" bgcolor="#b7b142" width="110" onclick="navHi(this,\'click\')" onmouseover="navHi(this,\'over\')" onmouseout="navHi(this,\'out\')">Street Furniture</td>\
						<td id="c4" bgcolor="black" width="110" onclick="navHi(this,\'click\')" onmouseover="navHi(this,\'over\')" onmouseout="navHi(this,\'out\')">bwa bausystem</td>\
						<td id="c5" bgcolor="#bdc1c2" width="90" onclick="navHi(this,\'click\')" onmouseover="navHi(this,\'over\')" onmouseout="navHi(this,\'out\')">Company</td>\
						<td id="c6" bgcolor="#bdc1c2" onclick="navHi(this,\'click\')" onmouseover="navHi(this,\'over\')" onmouseout="navHi(this,\'out\')">Service</td>\
					</tr>\
				</table>\
				<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#afb0b3" style="margin-top: 1px">\
					<tr>\
						<td><img src="images/blank.gif" alt="" height="1" width="10" border="0" /></td>\
					</tr>\
				</table>\
				<table width="100%" height="110" border="0" cellspacing="0" cellpadding="0">\
						<tr>\
							<td align="left" valign="top" width="130"><div id="sub1"><img src="images/nav_hi_1.gif" alt="" height="9" width="38" border="0"></div></td>\
							<td align="left" valign="top" width="130"><div id="sub2"><img src="images/nav_hi_2.gif" alt="" height="9" width="38" border="0"></div></td>\
							<td align="left" valign="top" width="120"><div id="sub3"><img src="images/nav_hi_3.gif" alt="" height="9" width="39" border="0"></div></td>\
							<td align="left" valign="top" width="120"><div id="sub4"><img src="images/bwa_thing.gif" alt="" height="40" width="119" border="0"></div></td>\
							<td align="left" valign="top" width="100"><div id="sub5">\
								<table width="100%" border="0" cellspacing="0" cellpadding="0" class="sub_nav">\
									<tr>\
										<td id="s1" class="sub_item" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">profile</td>\
									</tr>\
									<tr>\
										<td id="s2" class="sub_item" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">partner</td>\
									</tr>\
									<tr>\
										<td id="s3" class="sub_item" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">current projects</td>\
									</tr>\
									<tr>\
										<td id="s4" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">references</td>\
									</tr>\
								</table>\
								</div>\
							</td>\
							<td align="left" valign="top"><div id="sub6">\
								<table width="100%" border="0" cellspacing="0" cellpadding="0" class="sub_nav">\
									<tr>\
										<td id="s1" class="sub_item" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">planning</td>\
									</tr>\
									<tr>\
										<td id="s2" class="sub_item" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">installation service</td>\
									</tr>\
									<tr>\
										<td id="s3" class="sub_item" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">metal construction / welding </td>\
									</tr>\
									<tr>\
										<td id="s4" align="left" valign="top" onclick="subHi(this,\'click\')" onmouseover="subHi(this,\'over\')" onmouseout="subHi(this,\'out\')">delivery service </td>\
									</tr>\
								</table>\
								</div>\
							</td>\
						</tr>\
					</table>';
	}
	
	document.getElementById('danav').innerHTML = out;
	if(lang == '_de'){
	var out = '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bot_nav" bgcolor="#eff0f0">\
					<tr>\
							<td width="200"><a href="javascript:navClick(\'c702\')">Katalog anfordern / Download</a></td>\
							<td width="90"><a href="javascript:navClick(\'c703\')">Impressum</a></td>\
							<td><a href="files/GRO_agbs.pdf" target="_new">Allgemeine Geschäftsbedingungen</a></td>\
						</tr>\
				</table>\
				<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#afb0b3" style="margin-top: 2px; margin-bottom: 2px">\
					<tr>\
						<td><img src="images/blank.gif" alt="" height="1" width="10" border="0"></td>\
					</tr>\
				</table>\
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bot_nav2">\
					<tr>\
						<td width="250"><strong>GRONARD ®</strong> Metallbau &amp; Stadtmobiliar GmbH</td>\
						<td>Bayerwaldstraße 23</td>\
						<td>81737 München</td>\
						<td>Telefon +49 (0)89 / 670 10 15</td>\
						<td><a href="mailto:info@gronard.de"><font class="text">info@gronard.de</font></a></td>\
					</tr>\
				</table><br><br>';
				}
				
	if(lang == '_en'){
	var out = '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bot_nav" bgcolor="#eff0f0">\
					<tr>\
							<td width="200"><a href="javascript:navClick(\'c702\')">Catalogue request / Download</a></td>\
							<td width="60"><a href="javascript:navClick(\'c703\')">Legal</a></td>\
							<td><a href="files/GRO_agbs.pdf" target="_new">Terms of business</a></td>\
						</tr>\
				</table>\
				<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#afb0b3" style="margin-top: 2px; margin-bottom: 2px">\
					<tr>\
						<td><img src="images/blank.gif" alt="" height="1" width="10" border="0"></td>\
					</tr>\
				</table>\
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="bot_nav2">\
					<tr>\
						<td width="250"><strong>GRONARD ®</strong> Metallbau &amp; Stadtmobiliar GmbH</td>\
						<td>Bayerwaldstraße 23</td>\
						<td>81737 München</td>\
						<td>Telefon +49 (0)89 / 670 10 15</td>\
						<td><a href="mailto:info@gronard.de"><font class="text">info@gronard.de</font></a></td>\
					</tr>\
				</table><br><br>';
				}
	document.getElementById('botnav').innerHTML = out;
	
	if (n1 > 0) {				
		c1 = n1;
		c2 = n2;
		document.getElementById('sub'+n1).style.visibility = 'visible';
		if(n1 >= 5){
			if(n2 > 0){
				document.getElementById('sub'+n1).getElementsByTagName('td')[n2-1].style.color = '#324c71';
			}
		}
	}
}

function navClick(s){
	document.location.href = s + lang + '.php';
}

function listHi(obj,s,id,bwa,pos){
	if(s == 'over'){	
		document.body.style.cursor = 'pointer';
		//obj.style.color = '#ffffff';
		//obj.style.backgroundColor = '#fde7cd';
		obj.style.backgroundColor = '#CCE1F2';
		//document.getElementById('bigthumb_pic').src = link+'&ft=0'
		xy = findPos(obj)
		if (pos == 'left') {
			document.getElementById('bigthumb_'+id).style.left = xy[0]-412;
		} else {
			document.getElementById('bigthumb_'+id).style.left = xy[0]+245;
		}
		document.getElementById('bigthumb_'+id).style.top = xy[1]-206;
		document.getElementById('bigthumb_'+id).style.visibility = 'visible';
	}
	if(s == 'out'){
		document.body.style.cursor = 'auto';
		//obj.style.color = '#324C71';
		obj.style.backgroundColor = '#F1F1F1'
		// document.getElementById('bigthumb_pic').src = 'images/blank.gif'
		document.getElementById('bigthumb_'+id).style.visibility = 'hidden';
	}
	if(s == 'click'){
		if (typeof id != "undefined") {
			document.location.href = bwa + 'entry' + lang + '.php?id=' + id;
		} else {
			document.location.href = bwa + 'entry' + lang + '.php';
		}
	}
}

function langToggle(){
	var lo = document.location.href.split('#')[0].split('/');
	var li = lo[lo.length-1].split('_')[0];
	if(lang == "_de"){
		document.location.href = li + '_en.php' + document.location.search;
	}
	else{
		document.location.href = li + '_de.php' + document.location.search;
	}
}

function get_media_link(id,s) {
	return "admin/inc/download.inc.php?t=thumb&s=" + s + "&login=flash&password=a39401275d1b300aa789fb22aea4148a&md5=1&ids=" + id;
}

function createXMLHttpRequest() {
    if (typeof XMLHttpRequest != "undefined") {
        return new XMLHttpRequest();
    } else if (typeof ActiveXObject != "undefined") {
        return new ActiveXObject("Microsoft.XMLHTTP");
    } else {
        throw new Error("XMLHttpRequest not supported");
    }
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}

function sendMail() {
	if (document.getElementById('name1').value == '' ||
			document.getElementById('name2').value == '' ||
			document.getElementById('email').value == '' ||
			document.getElementById('tel').value == '' ||
			document.getElementById('subject').value == '' ||
			document.getElementById('text').value == '') {
			document.getElementById('mail_error_msg').innerHTML = 'Bitte füllen Sie alle Felder aus';
	} else {
		var request = createXMLHttpRequest();		
		var data = 	"name1=" + (encodeURIComponent(document.getElementById('name1').value)) +
								"&name2=" + (encodeURIComponent(document.getElementById('name2').value)) +
								"&email=" + (encodeURIComponent(document.getElementById('email').value)) +
								"&address=" + (encodeURIComponent(document.getElementById('address').value)) +
								"&tel=" + (encodeURIComponent(document.getElementById('tel').value)) +
								"&subject=" + (encodeURIComponent(document.getElementById('subject').value)) +
								"&text=" + (encodeURIComponent(document.getElementById('text').value));
	
		request.open("POST", "inc/sendmail.php", true);
	
		request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		request.setRequestHeader("Content-length", data.length);
		request.setRequestHeader("Connection", "close");
	
		request.onreadystatechange = function() {			
			if (request.readyState == 4) {
				document.getElementById('mail_error_msg').innerHTML = 'Danke für Ihre Anfrage';
				setTimeout( function() {
					document.getElementById('emailframe').style.visibility = 'hidden';
					document.getElementById('mail_error_msg').innerHTML = '';
				}, 2500 );
			}
		}
		request.send(data);
	}
}

