
//Here are the main javascripts

    function GetXmlHttpObject() {
        try { return new XMLHttpRequest(); } catch(e) {}
        try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
        try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
        alert("Your browser does not support AJAX!");
        return false;
    }
	
    function ajAction(url, params, container, method, parent)
	{   //1. get the cmlhttp object
	    var xmlHttp=GetXmlHttpObject();     
	    if (xmlHttp==null){alert ("Your browser does not support AJAX!");return;}
	    //2.get the data into the desired element by ID	
        xmlHttp.onreadystatechange=function(){     
	    if(xmlHttp.readyState==4){if(xmlHttp.status == 200){
		    if(parent == true){window.parent.document.body.getElementById(container).innerHTML=xmlHttp.responseText;
			}else{document.getElementById(container).innerHTML=xmlHttp.responseText;}
			}}}
	    //3.send the data by params
	    if ((method == '') || (method == "GET")){
		    link = url + '?' + params + '&sid=' + Math.random();
		    xmlHttp.open("GET", link, true);
	        xmlHttp.send(null); 
		}else if (method == 'POST'){;
		    xmlHttp.open("POST", url, true);
            xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            xmlHttp.send(params);
        }
    }
	
    window.addEvent('domready', function(){
	    if($$('.mb').length > 0)//only triggered if 'mb' class found on page
	    {
		    var initMultiBox = new multiBox('mb', {
			    descClassName: 'multiBoxDesc',//the class name of the description divs
			    path: './templates/default/jscript/player/',//path to mp3 and flv players
			    useOverlay: true,//use a semi-transparent background. default: false;
			    maxWidth: 700,//max width (set to false to disable)
			    maxHeight: 700,//max height (set to false to disable)
			    addDownload: false,//do you want the files to be downloadable?
			    //pathToDownloadScript: './Scripts/ForceDownload.asp',//if above is true, specify download script
			    //addRollover: true,//add rollover fade to each multibox link
			    //addOverlayIcon: true,//adds overlay icons to images within multibox links
			    //addChain: true,//cycle through all images fading them out then in
			    recalcTop: true//subtract the height of controls panel from top position
		    });
	    }; })

    function pollVote()
	{
        var k;
		var answer=null;
		var nrAns = document.getElementById('number_answers').value;
		for(k=0;k<=nrAns;k++){
		    if(document.getElementById('pool_form_'+k).checked == true){
		        answer = document.getElementById('pool_form_'+k).value;
			}
		}
		
		if(answer != null){
            ajAction('iajax.php', 'action=vote-poll&answer='+answer, 'pool-field' , 'POST');
		}else if (answer == null){
		    alert('Please chose an option.');
		}   
	}  


