function homeN2K(){	
	try {
		n2khttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
	}  catch (e) { 
		alert("Error: Could not register, please try again.");
	}	
	
    n2khttp.onreadystatechange = function(){
               if ((n2khttp.readyState == 4) && (n2khttp.status == 200)) {
				   document.getElementById('right_kolom_top').innerHTML = n2khttp.responseText;
               }
    }

    n2khttp.open("POST", "n2ksmall.php");
    n2khttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    n2khttp.send(null);	
}

function homeVIDS(){
	try {
		vidhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
	}  catch (e) { 
		alert("Error: Could not register, please try again.");
	}	
	
    vidhttp.onreadystatechange = function(){
               if ((vidhttp.readyState == 4) && (vidhttp.status == 200)) {
				   document.getElementById('broadcast_mid').innerHTML = vidhttp.responseText;
               }
    }

    vidhttp.open("POST", "top6small.php");
    vidhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    vidhttp.send(null);	
}

function comsubmitMini(b){
	var tdata = "";
	var error = 0;
	var txt = ''; 
		txt = document.getElementById('n2k_comfield').value.replace(/<[^>]*>/g, "");
	
	if(txt.length > 2){
		txt = txt.replace(/[\n]/g,'<br />');
		tdata += "t=" + txt;
		tdata += "&c=" + 'n2k';
		tdata += "&k=" + b;
	}else{
		error = 1;	
	}
	
	try {
		comf = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
	}  catch (e) { 
		alert("Error: Could not register, please try again.");
	}	
	
    comf.onreadystatechange = function(){
               if ((comf.readyState == 4) && (comf.status == 200)) {

				  switch(comf.responseText){					  
					  case "1" : var st = "";
					  			 st += "<span style=\"color: #FFFFFF;\">";
								 st += "Your comment was submitted.";
								 st += "</span>";
								 document.getElementById('myfrom').innerHTML = '<div id="n2k_submit"></div>';
								 document.getElementById('n2k_submit').innerHTML = st;	
								 setTimeout( function() {homeN2K();},3000);
					  			 break;
					  case "0" : var st = "";
					  			 st += "<span style=\"color: #FFFFFF;\">";
								 st += "Please try again later.";
								 st += "</span>";
								 document.getElementById('n2k_submit').innerHTML = st;
					  			 break;
				  }
               }
    }
	
	
	if(error == 0){
	
		var tmp = "";
		tmp += "<span style=\"color: #FFFFFF;\">Please wait...</span>";
		
		document.getElementById('n2k_submit').innerHTML = tmp;
    
		comf.open("POST", "comloud.php");
		comf.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		comf.send(tdata);		
	}else{
		var tmp = "";
		tmp += "<span style=\"color: #FFFFFF;\">Please type a comment first.</span>";
		
		document.getElementById('n2k_submit').innerHTML= tmp;
		setTimeout( function() {resetN2KBTN(b);},3000);
	}	
}

function resetN2KBTN(b){
	var tmp = "";
	tmp += '<a href="javascript:comsubmitMini(\'' + b + '\');">';
	tmp += '<img border="0" src="images/body/TOP_right_kolom_submit.gif" alt="n2k_submit" />';
	tmp += '</a>';
	
	document.getElementById('n2k_submit').innerHTML = tmp;	
}
