function xmlhttpPost(strURL, argID, argNR) {

    var xmlHttpReq = false;

    var self = this;

    // Mozilla/Safari

    if (window.XMLHttpRequest) {

        self.xmlHttpReq = new XMLHttpRequest();

    }

    // IE

    else if (window.ActiveXObject) {

        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

    }

    self.xmlHttpReq.open('POST', strURL, true);

    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    self.xmlHttpReq.onreadystatechange = function() {

        if (self.xmlHttpReq.readyState == 4) {

            updatepage(self.xmlHttpReq.responseText);

        }

    }

    self.xmlHttpReq.send(getquerystring(argID, argNR));

}



function getquerystring(argID, argNR) {

    var form     = document.forms['vote'+argID+argNR];

    id_category = document.getElementById('id_category'+argID+argNR).value;

    id_game = document.getElementById('id_game'+argID+argNR).value;	

    vote_value = document.getElementById('vote_value'+argID+argNR).value;

	qstr = 'idc=' + id_category + '&idg=' + id_game + '&vva=' + vote_value;

    return qstr;

}



function updatepage(str){

    document.getElementById("result").innerHTML = str;

}


var but1;
var but2;
var but3;
var but4;
var but5;

function vote(arg1, arg2, arg3) {
	if(arg3 == 'vote') {

		 but1 = document.getElementById('button'+arg1+'1').className;

		 but2 = document.getElementById('button'+arg1+'2').className;

		 but3 = document.getElementById('button'+arg1+'3').className;				

		 but4 = document.getElementById('button'+arg1+'4').className;

		 but5 = document.getElementById('button'+arg1+'5').className;


		switch(arg2) {

				case 1:

					

						document.getElementById('button'+arg1+arg2).className = 'votted';

						document.getElementById('button'+arg1+'2').className = 'unvotted';

						document.getElementById('button'+arg1+'3').className = 'unvotted';

						document.getElementById('button'+arg1+'4').className = 'unvotted';

						document.getElementById('button'+arg1+'5').className = 'unvotted';

				break;

				case 2:

						document.getElementById('button'+arg1+'1').className = 'votted';

						document.getElementById('button'+arg1+arg2).className = 'votted';

						document.getElementById('button'+arg1+'3').className = 'unvotted';

						document.getElementById('button'+arg1+'4').className = 'unvotted';

						document.getElementById('button'+arg1+'5').className = 'unvotted';					

				break;

				case 3:

						document.getElementById('button'+arg1+'1').className = 'votted';

						document.getElementById('button'+arg1+'2').className = 'votted';

						document.getElementById('button'+arg1+arg2).className = 'votted';					

						document.getElementById('button'+arg1+'4').className = 'unvotted';

						document.getElementById('button'+arg1+'5').className = 'unvotted';	

				break;

				case 4:

						document.getElementById('button'+arg1+'1').className = 'votted';

						document.getElementById('button'+arg1+'2').className = 'votted';

						document.getElementById('button'+arg1+'3').className = 'votted';	

						document.getElementById('button'+arg1+arg2).className = 'votted';

						document.getElementById('button'+arg1+'5').className = 'unvotted';					

				break;

				case 5:
						document.getElementById('button'+arg1+'1').className = 'votted';

						document.getElementById('button'+arg1+'2').className = 'votted';

						document.getElementById('button'+arg1+'3').className = 'votted';						

						document.getElementById('button'+arg1+'4').className = 'votted';	

						document.getElementById('button'+arg1+arg2).className = 'votted';					

				break;

		}

	} else {


		document.getElementById('button'+arg1+'1').className = but1;

		document.getElementById('button'+arg1+'2').className = but2;

		document.getElementById('button'+arg1+'3').className = but3;		

		document.getElementById('button'+arg1+'4').className = but4;

		document.getElementById('button'+arg1+'5').className = but5;	

	}

}
function searchIT(){
 var TestVar = document.form_search.search_input.value;
  window.location = "http://www.ejocuribarbie.com/tag-"+TestVar+".html";

}
