//=======================POLL==========================
function viewResults(file, width, height) {
	attribute = "toolbar=no, scrollbars=2, directories=no, status=no, menubar=no, resizable=yes";
	attribute += ", width=" + width + ", height=" + height;
	window.open(file, 'voteWindow', attribute);
}
function postVote(url, p, c) {
	Today = new Date();
	Name = "Vote_Poll_IP_" + p + "_" + c + Today.getDate() + "_" + Today.getMonth() + "_" + Today.getYear();
	var NL = getCookieValueVote(Name); 
	if(NL == null) {
		vote = _gCV(document.forms['frmVote' + p + c].elements[p + "vote" + c]);
		if(vote > 0) {
			setCookieVote(Name, 'true', '', '');
			url += "&vt=123&vote=" + vote;
		}
	}
	viewResults(url, 400, 330);
}
function setCookieVote(cookieName, cookieValue, cookiePath, cookieExpires) { 
	cookieValue = escape(cookieValue); 
    if (cookieExpires == "") { 
    	var nowDate = new Date(); 
        nowDate.setMonth(nowDate.getMonth() + 6); 
        cookieExpires = nowDate.toGMTString(); 
    }
    if (cookiePath != "") {
		cookiePath = ";Path=" + cookiePath; 
    } 
    document.cookie = cookieName + "=" + cookieValue + ";expires=" + cookieExpires + cookiePath;     
} 
function _gCV(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}
function getCookieValueVote(name) { 
	var cookieString = document.cookie; 
    var index = cookieString.indexOf(name + "="); 

    if (index == -1) return null; 

	index = cookieString.indexOf("=", index) + 1; 
    var endstr = cookieString.indexOf(";", index); 

    if (endstr == -1) endstr = cookieString.length; 

    return unescape(cookieString.substring(index, endstr)); 
} 
function OpenWin(URL, winName, width, height, scroll) {
	var winLeft = (screen.width - width) / 2;
	var winTop = (screen.height - height) / 2;
				
	winData = 'height='+height+',width='+width+',top='+winTop+',left='+winLeft+',scrollbars='+scroll+',resizable';
	win = window.open(URL, winName, winData);
		
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
