

function getContent(p_div_content, p_div){

	var object = document.getElementById(p_div_content);
	var test = document.getElementById(p_div);
	for(var i=0; i < object.childNodes.length; i++){

		if(object.childNodes[i].tagName && object.childNodes[i].tagName.toLowerCase() == 'div')
		{
			object.childNodes[i].style.display='none';
		}
	}

	test.style.display='block';
}

function changeActiveTab(p_link){
	var object = p_link.parentNode;
	var object2 =  object.parentNode;
	var links = object2.getElementsByTagName('a');
	
	for(y=0;y<links.length;y++){
		if(links[y]!=p_link){
			links[y].className='';
		}
		else{
			links[y].className='current';
		}
		
	}
}


function get(obj, id, message,sport,lang) {
      var poststr = '';
	  var checked=0;
	  var total=0;
		var mesRdios = new Array();
		for(i=0;i<document.getElementById('myform').elements.length;i++){
		  	if(document.getElementById('myform').elements[i].type=='radio'){
			total++;
			  	if(document.getElementById('myform').elements[i].checked==true){
					checked++;
					poststr = poststr +'&'+document.getElementById('myform').elements[i].name+'='+document.getElementById('myform').elements[i].value;
				}
			}
		}
		if(checked<(total/3)){alert(message); return false;}
      makePOSTRequest('/'+lang+'/'+sport+'/sondage.php?tournament='+id, poststr);
}

 function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }
   
      function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('sondage').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   
   function attacherAction() {
		var allHTMLTags=document.getElementsByTagName("a");

		//Loop through all tags using a for loop
		for (i=0; i<allHTMLTags.length; i++) {

			//Get all tags with the specified class name.
			if (allHTMLTags[i].className=="htmlExpand") {

			//Place any code you want to apply to all
			//pages with the class specified.
			//In this example is to “display:none;” them
			//Making them all dissapear on the page.

			allHTMLTags[i].onclick= function() {
				               return hs.htmlExpand(this, { objectType: 'iframe', preserveContent: true} )
			}

			}
		}
		
		var allHTMLTags=document.getElementsByTagName("ul");
		//Loop through all tags using a for loop
		for (i=0; i<allHTMLTags.length; i++) {

			//Get all tags with the specified class name.
			if (allHTMLTags[i].className=="styleClmst" || allHTMLTags[i].className=="styleRslt"|| allHTMLTags[i].className=="onglet" || allHTMLTags[i].className=="styleClmstPool" || allHTMLTags[i].className=="styleClmstPrinc"|| allHTMLTags[i].className=="statOnglet" || allHTMLTags[i].className=="cadreBilanOnglet" || allHTMLTags[i].className=="OngletLink") {

			var test = allHTMLTags[i].getElementsByTagName('a');
			for(y=0;y<test.length;y++){
				test[y].onclick = function() {changeActiveTab(this);}
			}

			}
		}
	   
    }
	

function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}

	function addLoadEvent(func) {
	  var oldonload = window.onload;
	  if (typeof window.onload != 'function') {
	    window.onload = func;
	  } else {
	    window.onload = function() {
	      if (oldonload) {
	        oldonload();
	      }
	      func();
	    }
	  }
	}
	addLoadEvent(attacherAction);
	
	


