//Pulldown-Menü automatisch
function AutoPulldown(FormName)
{
var URL = FormName.options[FormName.selectedIndex].value;
window.location.href = URL;
}
//Popup Allgemein
function PopUpWindow(page,breite,hoehe) {
OpenWin = this.open(page, "CtrlWindow", "left=10,top=10,directories=no,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,width="+breite+",height="+hoehe+",resizable=no");
}

//MouseOver für BRD-Karte
function ShowRegio(loc) {
	window.document.xform.STADTSUCHE.value=loc;
} 
//Formularprüfung Kontaktformular
function checkFieldsKontakt(xform) {
missinginfo = "";
if (document.xform.f_Name.value == "") {
missinginfo += "\n     -  Firma / Name";
}
if ((document.xform.f_Email.value == "") || 
(document.xform.f_Email.value.indexOf('@') == -1) || 
(document.xform.f_Email.value.indexOf('.') == -1)) {
missinginfo += "\n     -  Email (z.B. info@rim.de)";
}

if(document.xform.f_Kommentar.value == "") {
missinginfo += "\n     -  Kommentar";
}

if (missinginfo != "") {
missinginfo = "Folgende Felder enthalten Fehler oder"+
"\nsind nicht vollständig ausgefüllt:\n" +
missinginfo +
"\n  "+ 
"\nBitte überprüfen Sie Ihre Eingaben!";
alert(missinginfo);
return false;
}
else return true;
}

//Popup für InfoCard
function PopUpInfoCard(page) {
OpenWin = this.open(page, "CtrlWindow", "left=10,top=10,directories=no,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,width=550,height=700,resizable=no");
}

//Popup FSI Pages 
function PopUpFSIPages(url) {
OpenWin = this.open(url,'','left=50,top=50,scrollbars=no,menubar=no,height=500,width=600,resizable=no,toolbar=no,location=no,status=no'); 
}

//Formularprüfung Jobanmeldung
function CheckFieldsJobAnmeldung(JobForm) {
missinginfo = "";
if (document.JobForm.frmName.value == "") {
missinginfo += "\n     -  Name / Firma";
}
if ((document.JobForm.frmEmail.value == "") || 
(document.JobForm.frmEmail.value.indexOf('@') == -1) || 
(document.JobForm.frmEmail.value.indexOf('.') == -1)) {
missinginfo += "\n     -  Email (z.B. info@rim.de)";
}
if (document.JobForm.Beschreibung.value == "") {
missinginfo += "\n     -  Beschreibung";
}
if (missinginfo != "") {
missinginfo = "Folgende Felder enthalten Fehler oder"+
"\nsind nicht vollständig ausgefüllt:\n" +
missinginfo +
"\n  "+ 
"\nBitte überprüfen Sie Ihre Eingaben!";
alert(missinginfo);
return false;
}
else return true;
}

//Formularprüfung LinkAnmelden.asp
function CheckFieldsLinkAnmelden(xform) {
missinginfo = "";
if (document.xform.f_Link.value == "") {
missinginfo += "\n     -  Name / Titel der Site";
}

if ((document.xform.f_URL.value == "") || 
(document.xform.f_URL.value.indexOf("http://") == -1) || 
(document.xform.f_URL.value.indexOf(".") == -1)) {
missinginfo += "\n     -  URL (z.B. http://www.rim.de)";
}
if (missinginfo != "") {
missinginfo = "Folgende Felder enthalten Fehler oder"+
"\nsind nicht vollständig ausgefüllt:\n" +
missinginfo +
"\n  "+ 
"\nBitte überprüfen Sie Ihre Eingaben!";
alert(missinginfo);
return false;
}
else return true;
}

//Formularprüfung LinkAnmelden2.asp
function CheckFieldsLinkAnmelden2(xform) {
missinginfo = "";

if ((document.xform.f_Firma.value != "") && 
(document.xform.f_Email.value == "")) {
missinginfo += "\n     -  Firmen-Email";
}

if (missinginfo != "") {
missinginfo = "Folgende Felder enthalten Fehler oder"+
"\nsind nicht vollständig ausgefüllt:\n" +
missinginfo +
"\n  "+ 
"\nBitte überprüfen Sie Ihre Eingaben!";
alert(missinginfo);
return false;
}
else return true;
}

//Formularprüfung LinkGarantie
function CheckFormGar(xform) {
missinginfo = "";
if ((document.xform.f_URL.value == "") || 
(document.xform.f_URL.value.indexOf("http://") == -1) || 
(document.xform.f_URL.value.indexOf(".") == -1)) {
missinginfo += "\n     -  URL (z.B. http://www.rim.de)";
}
if (document.xform.f_Name.value == "") {
missinginfo += "\n     -  Name";
}
if (document.xform.f_Strasse.value == "") {
missinginfo += "\n     -  Strasse";
}
if (document.xform.f_Ort.value == "") {
missinginfo += "\n     -  PLZ/Ort";
}
if (missinginfo != "") {
missinginfo = "Folgende Felder enthalten Fehler oder"+
"\nsind nicht vollständig ausgefüllt:\n" +
missinginfo +
"\n  "+ 
"\nBitte überprüfen Sie Ihre Eingaben!";
alert(missinginfo);
return false;
}
else return true;
}

//Öffnet bei bikelinks Formular für Radreiseveranstalter
function OpenForm(Gruppe) {
     if (Gruppe.style.display == "none") {
      Gruppe.style.display = "" 
       } else {
       Gruppe.style.display = "none" ;
       }
   }

   
 //Öffnet Bild in neuem Fenster und gleicht Browsergröße automatisch an
function PopUpAutoImage(img){
  foto1= new Image();
  foto1.src=(img);
  Kontrolle(img);
}
function Kontrolle(img){
  if((foto1.width!=0)&&(foto1.height!=0)){ 
    viewFoto(img);
  }
  else{ 
    funzione="Kontrolle('"+img+"')"; 
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img){
  largh=foto1.width+20;
  altez=foto1.height+30;
  stringa="width="+largh+",height="+altez;
  //finestra=window.open(img,"",stringa);
  var win=window.open("","",stringa);
  win.document.writeln("<html><title>Picture Zoom</title>");
  win.document.writeln("<body bgcolor=#ffffff><a href='javascript:window.close();'><img src="+img+" style='border:solid 1px black;'></a></body>"+"</html>");

}

// img ToolTip
/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/ 

var wX=1
var hY=1

if (document.getElementById || document.all){
	document.write('<div id="trailimageid" style="position:absolute;visibility:hidden;left:0px;top:-1000px;vertical-align:text-bottom;width:1px;height:1px;border:1px solid #808080;background-color:#fff;background-image:url(http://www.sportshops.de/media/load.gif);background-repeat:no-repeat;background-position:center;">')
	document.write('<img id="trailimage" src="http://www.sportshops.de/media/trans.gif" />')
	document.write('</div>')
}

function gettrailobj()
{
	if (document.getElementById) return document.getElementById("trailimageid").style
	else if (document.all) return document.all.trailimagid.style
}

function truebody()
{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function hidetrail()
{
	document.onmousemove=""
	document.getElementById('trailimage').src='http://www.sportshops.de/media/trans.gif'
	gettrailobj().visibility="hidden"
	gettrailobj().left=-1000
	gettrailobj().top=0
}


function showTip(width,height,file)
{
	if(navigator.userAgent.toLowerCase().indexOf('opera') == -1)
	{
		wX=width
		hY=height
	
		document.getElementById('trailimage').src=file
		document.onmousemove=followmouse
		gettrailobj().visibility="visible"
		gettrailobj().width=wX+"px"
		gettrailobj().height=hY+"px"
	}
}

function followmouse(e)
{
	if(navigator.userAgent.toLowerCase().indexOf('opera') == -1)
	{
		var xcoord=20
		var ycoord=5

		if (typeof e != "undefined")
		{
			xcoord+=e.pageX
			ycoord+=e.pageY
		}
		else if (typeof window.event !="undefined")
		{
			xcoord+=truebody().scrollLeft+event.clientX
			ycoord+=truebody().scrollTop+event.clientY
		}

		var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
		var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)

		if (xcoord+wX+3>docwidth)
		xcoord=xcoord-wX-(20*2)

		if (ycoord-truebody().scrollTop+hY>truebody().clientHeight)
		ycoord=ycoord-hY;

		gettrailobj().left=xcoord+"px"
		gettrailobj().top=ycoord+"px"

	}
}

function imgTip(img,url,zoom){
	var _x = document.getElementById(img).width*zoom;
	var _y = document.getElementById(img).height*zoom;
	if ( _y > _x ){
		var newX = Math.round(_x * _x / _y);
		_y = _x;
		_x = newX;
	}	
	showTip(_x,_y,url+'frmImageWidth='+_x+'&frmImageMaxHeight='+_y+'');
}
// onclick="goToURL('parent','url');return document.returnValue"
function goToURL() {
  var i, args=goToURL.arguments; document.returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
