
function hidetagsIE(TagNamen){
  if ( navigator.userAgent.indexOf("MSIE 6") != -1 ){
    var no = 0;
    while (document.getElementsByTagName(TagNamen)[no]){
      document.getElementsByTagName(TagNamen)[no].style.visibility = "hidden"; 
      no++;
    }
  }
}
function showtagsIE(TagNamen){
  if ( navigator.userAgent.indexOf("MSIE 6") != -1 ){
    var no = 0;
    while (document.getElementsByTagName(TagNamen)[no]){
      document.getElementsByTagName(TagNamen)[no].style.visibility = "visible"; 
      no++;
    }
  }
}
  function istvorhanden(id) {
    if (document.getElementById(id) && document.getElementById(id).style.display == "block"){
      return true;
    }else{
      return false;
    }
  
  }

function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

var nolink = false;
var noexitpop = false;


function ajaxstats(page) {

	if(window.XMLHttpRequest)
	{
    	try 
		{
			req = new XMLHttpRequest();
        } 
		catch(e) 
		{
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } 
	else if(window.ActiveXObject) 
	{ 
       	try 
		{
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} 
		catch(e) 
		{
        	try 
			{
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} 
			catch(e) 
			{
          		req = false;
        	}
		}
    }
	if(req && page != 0) 
	{
		urlx = "/cgi-bin/49lp.pl?file=images/pixel.gif&partner_pk="+page+"&ident=close&wingame_pk=32";
		randurl = urlx + "&" + Math.random();
		req.open("GET", randurl, true);
		req.send("");	
	}
}

	
var wieoft = 0;

function checkcoregs() {

	var inputs = $$("input");
	var cinputs = inputs.length;
	var myquestions = new Array();
	var q_counter = 0;
	
	var questionid;
	var question;
	var answer;

	for (i = 0; i < cinputs; i++) {
		if (inputs[i].name.substr(0, 10) == "question::") {
			myquestions[q_counter] = inputs[i].name.substr(10);
			q_counter++;
		}
	}
	
	for (i = 0; i < q_counter; i++) {
		questionid = "question::" + myquestions[i];
		if ($(questionid).checked) {
			question = "specialanswerb_" + myquestions[i];
			answer = "specialanswer_" + myquestions[i];
			if ($(question).value != $(answer).value) {
				$(answer).className = "text textfalse";
				$(question).className = "text textfalse";
				swapin("fault_" + myquestions[i], "fault");
				return false;
			} else { 
				$(answer).className = "text";
				$(question).className = "text";
				swapout("fault_" + myquestions[i]);
			}
		}
	} 
	return true;
}

function checkform() {	
	
	if (!document.register.agb.checked) { 
		wieoft++; 
		if(wieoft <= 2) { 
			//printSound();
			alert('Haben Sie alle Felder\nvollständig und richtig\nausgefüllt und angekreuzt?'); 
			return false;
		}		
	}
	return true;
		
}
	
function hidelayer(divs) {
		document.getElementById(divs).style.display = "none";
		if(divs == "popinfo") document.getElementById("landselect").style.display = "block";
	}
	
function showlayer(divs) {
		document.getElementById(divs).style.display = "block";
		if(divs == "popinfo") document.getElementById("landselect").style.display = "none";
	}
	
function checkthebox(boxname) {
	if (document.inter.elements[boxname].checked == true) {
		document.inter.elements[boxname].checked = false;
		}
	else {
		document.inter.elements[boxname].checked = true;
		}
	}
	
function submitCoregLayer(coreg,client_pk,copy)
{
	if (document.getElementById("question::502").checked == true)
	{
		var req = new Request({

			url: "/cgi-bin/wingame.pl?todo=do_save_coreg_502&client_pk="+client_pk+"&copy="+copy+"&specialanswer_502="+document.getElementById("specialanswer_502").value,
			method: 'GET'
		});
		req.send();
	}
	hidelayer('coreg_layer');
	showtagsIE('select');
}

function swapper(id, thisclass) {
	var div = document.getElementById(id);
	(div.className == "swapin " + thisclass) ? div.className = "swapout" : div.className = "swapin " + thisclass;
}

function swapin(id, thisclass) {
	document.getElementById(id).className = "swapin " + thisclass;
}

function swapout(id) {
	document.getElementById(id).className = "swapout";
}

// Coreg
// check the coreg checkfield if the user make changes in input fields
function checkCoreg(this_id) {
	document.getElementById(this_id).checked = true;
}


