// JavaScript Document
function gotoUrl(str){
	window.location.href = str;
}

///////////////////////////////////////////////////////////////
//
// Author : Le Minh Duy (md_fpt@yahoo.com)
// Project: Tapchilaptop.com
// Version: 1.0.0
//
///////////////////////////////////////////////////////////////
function removeCheck(e) {
	var inputs; 
	inputs = document.getElementsByTagName('input');	
	
	for(var i=0; i<inputs.length; i++) {		
		if(inputs[i].getAttribute('type') == 'checkbox') {		
			if(inputs[i] != e) {
				inputs[i].checked = false;
			}			
		}
	}
}
function checkVote(pid) {
	var inputs; 
	var checked = false;
	var height;
	var val=0;
	
	inputs = document.getElementsByTagName('input');	
	for(var i=0; i<inputs.length; i++) {		
		if(inputs[i].getAttribute('type') == 'checkbox') {			
				if(inputs[i].checked) {
					checked = true;	
					val = inputs[i].value;
					break;
				}
		}
	}
	
	if(!checked) {
		alert("Xin vui lòng chọn một biểu quyết trước khi bình chọn !");
		return false;
	}
	
	height = inputs.length * 20;
	open('vote.php?poll='+ pid +'&id='+val, 'NVCOM', 'scrollbars=yes,resizeable=no,locationbar=no,width=500,height='+height+',left='.concat((screen.width - 500)/2).concat(',top=').concat((screen.height - 250)/2));
	return true;
}

function resultVote(id) {
	var inputs; 
	var height = 0;
	inputs = document.getElementsByTagName('input');	
	height = inputs.length * 20;
	open('vote.php?poll='+ id, 'NVCOM', 'scrollbars=yes,resizeable=no,locationbar=no,width=500,height='+height+',left='.concat((screen.width - 500)/2).concat(',top=').concat((screen.height - 250)/2));
	return true;
}

