//Onmouse over
function navButton(normal, active)
{
	this.normal=new Image();
	this.active=new Image();
	
	this.normal.src="/custom/_gfx/"+normal;
	this.active.src="/custom/_gfx/"+active;
	
}

//Toolbox
var menueButton=new Array();
menueButton['bookmark']= new navButton("img_bookmark.gif","img_bookmark_a.gif");
menueButton['sendarticle']= new navButton("img_sendarticle.gif","img_sendarticle_a.gif");
menueButton['print']= new navButton("img_print.gif","img_print_a.gif");

function active(which)
{
	if(document.images)
	{
		//alert(menueButton[which].active.src);
		
		document.images[which].src=menueButton[which].active.src;
	}

}

function inactive(which)
{
	if(document.images)
	{
		document.images[which].src=menueButton[which].normal.src;
	}

}

//------------------------------------

//Add to favorites
function addfav(title,url)
{
	 if (document.all){
		window.external.AddFavorite(url,title)
	}
	else if (window.sidebar){
		window.sidebar.addPanel(title, url, "")
	}
}
//------------------------------------

//Print
function popup_print(url,pagetitle)
{
	var popup = window.open(url, pagetitle, "width=525,height=450,dependent=yes,locationbar=no,menubar=no,resizable=yes,status=no,scrollbars=yes");
}
//------------------------------------

function popup_travel_tools()

{

	var url ;

	url =event.srcElement.options[event.srcElement.selectedIndex].value;

         if (url!=''){	

	window.open(url, "Popup1", "width=400,height=600,dependent=yes,locationbar=no,menubar=no,resizable=yes,scrollbars=yes,status=no");

         }
}

//------------------------------------

function travel_tools_popup(e)

{

	if( !e ) e = window.event; 

	var target; 

	if( e.srcElement ) target = e.srcElement.options[e.srcElement.selectedIndex].value; 

	else if( e.target ) target = e.target.options[e.target.selectedIndex].value; 

  if (target!=''){	

	window.open(target, "Popup1", "width=400,height=560,dependent=yes,locationbar=no,menubar=no,resizable=yes,scrollbars=yes,status=no");

         }

}

//------------------------------------

function travel_tools_popup2 (url) 
{

	var travel_tools_popup2 = window.open(url, "Popup1", "width=358,height=525,dependent=yes,locationbar=no,menubar=no,resizable=yes,scrollbars=yes,status=no");
}

//------------------------------------

document.getElementsByClassName = function(cl) {
						var retnode = [];
						var myclass = new RegExp('\\b'+cl+'\\b');
						var elem = this.getElementsByTagName('*');
						for (var i = 0; i < elem.length; i++) {
						   var classes = elem[i].className;
						   if (myclass.test(classes)) retnode.push(elem[i]);
						   }
						return retnode;
}


function obsolete_checkTheForm(formname){
returnvalue = true;

		a1 = validatefield (formname, "name", "text");
		a2 = validatefield (formname, "surname", "text");
		a3 = validatefield (formname, "password", "password");
		a4 = validatefield (formname, "how_payed_attention", "select-one");
		a5 = validatefield (formname, "myselectbox", "select-multiple");
		a6 = validatefield (formname, "answer", "radio");
		a7 = validatefield (formname, "acceptterms", "checkbox");
		a8 = validatefield (formname, "test", "radio");
		a9 = validatefield (formname, "myselect", "select-multiple");
		a10 = validatefield (formname, "multitext", "textarea");
		a11 = validatefield (formname, "fileupload", "");

		sum = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11;
		
		
		if (sum > 0){
			returnvalue = false;
		}
	
		if (returnvalue == false){
				document.getElementById("finalerrortext" + 10000).style.display = 'block';
			}
			else{
				if (document.getElementById("finalerrortext" + 10000) != null){
						document.getElementById("finalerrortext" + 10000).style.display = 'none';
				}
			}
		
return returnvalue;
}



function validatefield(formname, fieldname, fieldtype){
			
			ret = 0;
			
					//for (n=0; n<formname.elements.length;n++){
						
										
					element = formname.elements[fieldname];
					
					//Für die Elemente Text/Password; Selectboxes 1 & Multiple; Textarea		

						if (element.type == 'text' || element.type == 'select-one' || element.type == 'password' || element.type == 'textarea'){
						
								if (element.value == ''){
												document.getElementById("errortext" + element.id).style.display = 'inline';
												ret = 1;
								}
								else{
									if (document.getElementById("errortext" + element.id) != null){
										document.getElementById("errortext" + element.id).style.display = 'none';
									}
								}
						}
						
						if (element.type == 'file'){
						
								if (element.value == ''){
												document.getElementById("errortext" + element.id).style.display = 'inline';
												ret = 1;
								}
								else{
									if (document.getElementById("errortext" + element.id) != null){
										document.getElementById("errortext" + element.id).style.display = 'none';
									}
								}
						}
						
						
						if (element.type == 'checkbox'){
								if (element.checked == false){
												document.getElementById("errortext" + element.id).style.display = 'inline';
												ret = 1;
								}
								else{
									if (document.getElementById("errortext" + element.id) != null){
										document.getElementById("errortext" + element.id).style.display = 'none';
									}
								}
						}
						
					
						if(fieldtype == "radio"){
						//bei radiobuttons muss mindestens einer gechecked sein !!!
						var oneischecked = false;
						
							for(l=0; l<formname.elements[fieldname].length; l++){
							//alert(formname.elements(fieldname)[l].type);
							//alert(formname.elements(fieldname)[l].checked);
								if (formname.elements[fieldname][l].checked == true){
									oneischecked = true;
								}
							}

								if (oneischecked == false){
												document.getElementById("errortext" + formname.elements[fieldname][0].id).style.display = 'inline';
												ret = 1;
								}
								
								else{
									if (document.getElementById("errortext" + formname.elements[fieldname][0].id) != null){
										document.getElementById("errortext" + formname.elements[fieldname][0].id).style.display = 'none';
									}
								}
								
						}
										
						if(element.type == 'select-multiple'){
						var selectcounter = 0;
						//alert(document.getElementById(element.id).innerHTML);
						//holt sich die zahl der mindestens zu selektierenden optionen im muliple select aus unsichtbarem div!
						//dieser div muss die gleiche id haben, wie das betr. selectelement!!!!
						var minselect = document.getElementById(element.id).innerHTML;
						
						for(i=0; i<element.options.length; i++){
							if (element.options[i].selected == true){
								selectcounter = selectcounter + 1;
							}
						}
						
								if (selectcounter < minselect){
												document.getElementById("errortext" + element.id).style.display = 'inline';
												ret = 1;
								}
								else{
									if (document.getElementById("errortext" + element.id) != null){
										document.getElementById("errortext" + element.id).style.display = 'none';
									}
								}
						}		
						
						
										
					//}
			return ret;			
}

//------------------------------------
