/**
 * Redirect-Function, if page is not opened in a frameset
 *
 * @author      Gue
 * @version     1.0
 * @changes
 * 
 *
 */
/******************** EINSTELLUNGEN *********************/
function individualPageList()
{
	return "intewa-regenwassertechnik_sitemap.html"+
	       "bezugsquellen_de.php"+
	       "planungsbogen-regenwassernutzung.php"+
	       "bezugsquellen_de.php"+
	       "planungsbogen-regenwasserrueckhaltung.php"+
	       "planungsbogen-regenwasserversickerung.php";
}

function getHost()
{
	//return window.location.host;
	return "www.intewa.de"; //HART-VERDRAHTET
}
function getRedirectPage()
{
	return "index-individual.php"; //HART-VERDRAHTET
}
function getURLRedirectParameter()
{
	return "rdp";
}
/******************** EINSTELLUNGEN ENDE*********************/
function test()
{
	alert('framecheck included !!');	
}

function getIDofURL(wert)
{
	 var Ergebnis;
	 var Ausdruck = /(_)(\d.+)(\.html)/;
	 var Erg = wert.search (Ausdruck);
	 if(Erg != -1) Ergebnis = wert.match(Ausdruck);
	 return Ergebnis[2];
}
function getCATofURL(wert)
{
	 var Ergebnis;
	 var Ausdruck = /(_c)(\d.+)(\.html)/;
	 var Erg = wert.search (Ausdruck);
	 if(Erg != -1) Ergebnis = wert.match(Ausdruck);
	 return Ergebnis[2];
}
function getLastStringExkl(wert,separator)
{
 	 var pos = wert.lastIndexOf(separator);
	 if(pos != -1)
	 {
	 	wert = wert.substr(pos+1,wert.length);
	 }
	 return wert;
}
function getLastStringInkl(wert,separator)
{
 	 var pos = wert.lastIndexOf(separator);
	 if(pos != -1)
	 {
	 	wert = wert.substr(pos,wert.length);
	 }
	 return wert;
}
function cutLastString(wert,separator)
{
 	 var pos = wert.lastIndexOf(separator);
	 if(pos != -1)
	 {
	 	wert = wert.substr(0,pos);
	 }
	 return wert;
}
function getPathname(uri)
{
	uri = cutLastString(uri,"?");
	uri = getLastStringExkl(uri,"/");
	return uri;
}

 function standalone() 
 { 
    return (self == top);
 }
 function redirectToINTEWA() 
 { 
 	var filename = getPathname(window.location.pathname);
 	bindividual_page = individualPageList().search(filename);
 	
 	if(bindividual_page != -1)
 	{
 //alert(individualPageList()+'#individual-#'+filename);
 	window.location.href = 'http://'+getHost()+
 				"/"+getRedirectPage()+"?"+
 				getURLRedirectParameter()+
 				"="+
 				filename;
 	}
 	else if(window.location.search)
 	{
   		window.location.href = 'http://'+getHost()+'/index.php'+window.location.search;
	}
	else
	{
	var pathtype;
		   var pathid = window.location.pathname;
		   var pos1 = pathid.indexOf("_");
		   if(pos1 != -1)
		   {
		   	pathid = getLastStringInkl(pathid,"_");
		   	var pos2 = pathid.indexOf("c");
		   	if(pos2 != -1)
		   	{
			   pathid = getCATofURL(pathid);
			   pathtype = 'cat';
		   	}
		   	else
	   		{
			   pathid = getIDofURL(pathid);
			   pathtype = 'id';
	   		}
		   	//alert('http://'+window.location.host+'/index.php?'+pathtype+'='+pathid);
		   	//window.location.href = 'http://'+window.location.host+'/index.php?'+pathtype+'='+pathid;
		   	//alert('http://'+getHost()+'/index.php?'+pathtype+'='+pathid);
		   	window.location.href = 'http://'+getHost()+'/index.php?'+pathtype+'='+pathid;
   }
   else
   {
   	window.location.href = 'http://'+getHost();
   }
  }   

 }
 function wstatus()
 {
    window.status = 'Zu den Hauptseiten der Intewa-Gmbh';
 }
 function outputLink()
 {
//    window.status="http://www.intewa.de";
//    document.writeln("<table width=98% border=0>"+
//       "<tr>"+
//      "<td>&nbsp;</td>"+
//     "<td align=right>"+
//                    "<a href=javascript:redirectToINTEWA();>Zu den Hauptseiten der Intewa-GmbH - Ihr Spezialist für Regenwassertechnik</a></td>"+
//                 "</tr>"+
//"</table>");
 }