function voteUpOverFunc(eid){
	document.getElementById("up_thumb_id" + eid).src = '../images/green-hand.gif';		
}

function voteUpOutFunc(eid){
	document.getElementById("up_thumb_id" + eid).src = '../images/up-dark.gif';	
}

function voteDownOverFunc(eid){
	document.getElementById("down_thumb_id" + eid).src = '../images/red-hand.gif';			
}

function voteDownOutFunc(eid){
	document.getElementById("down_thumb_id" + eid).src = '../images/down-dark.gif';			
}

function getXMLHttpHandler() {
	xObj = null;
	if(window.ActiveXObject){
		xObj = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if(window.XMLHttpRequest){
		xObj = new XMLHttpRequest();
	}	
	return xObj;
}
function loadXmlDoc(strXML,sync){
	/*e = strXML.indexOf("?>");
	strXML = strXML.substring(e+2,strXML.length);
	strXML = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + strXML;
	*/
	var tryO = 0;
	try{
		tryO = 1;
		xDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
		tryO = 2;
		xDoc.async = (sync) ? false : true;
		tryO = 3;
		xDoc.validateOnParse = true;
		tryO = 4;
		if (!xDoc.loadXML(strXML)) 
		{
			tryO = 5;
			alert(xDoc.parseError.reason + "\n" + xDoc.parseError.srcText);
			return false;
		}
		else {			
			return xDoc;
		}
	}catch(e){
		alert("ERROR:" + tryO + "\n" + e.message);
		return false;
	}
	
}

var incrementalVal = 10;
function NewWindow(mypage, myname, w, h, otherProps) {
	if(otherProps)
	{
		if(otherProps.toLowerCase().indexOf("modal=yes") > -1)
		{
			return startWizard(mypage, myname, w, h)
		}
	}
	var xPos = (screen.width - w) / 2;
	var yPos = ((screen.height - h) / 2)-(15+incrementalVal);		
	if(otherProps)
		otherProps = ","+otherProps
	else
		otherProps = "";
	winprops = 'height='+h+',width='+w+',top='+yPos+',left='+xPos+otherProps
	win = window.open(mypage,myname,winprops)		
	//if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	return win;
}

function voteActFunc(eid,cid,act){
	var url = "common_script.cfm?key=1&eid=" + eid + "&cid=" + cid + "&act=" + act;
	var xml = new XT.ParseXML(url);
	var doc = xml.parse();			
	if(doc){
		if(doc.result){
			
			voteVal = doc.result.votelist;
			upvote = voteVal.upval;
			downvote = voteVal.downval;
			
			
			if(upvote > 0)
				document.getElementById("upID_" + eid).innerHTML = '<a href="##" class="voteUpcls" onclick="return false;" onmouseover="usersDivFunc(' + eid + ',' + cid + ',1,1);" onmouseout="usersDivFunc(' + eid + ',' + cid + ',2,1);" >' + upvote + '</a>';
			else
				document.getElementById("upID_" + eid).innerHTML = '<a href="##" class="voteUpcls" onclick="return false;">' + upvote + '</a>';
			
			if(downvote > 0)
				document.getElementById("downID_" + eid).innerHTML = '<a href="##" onclick="return false;" class="voteDowncls" onmouseover="usersDivFunc(' + eid + ',' + cid + ',1,2);" onmouseout="usersDivFunc(' + eid + ',' + cid + ',2,2);">' + downvote + '</a>';
			else
				document.getElementById("downID_" + eid).innerHTML = '<a href="##" class="voteDowncls" onclick="return false;">' + downvote + '</a>';
			
			if(act == 1){
				
				document.getElementById("imgUp_" + eid).innerHTML = '<img src="../images/green-hand.gif" border="0" id="up_thumb_id' + eid + '">';
				document.getElementById("imgDown_" + eid).innerHTML = '<img src="../images/down-dark.gif" border="0" id="down_thumb_id' + eid + '" style="cursor:pointer;" title=" Bad Resume or Bad Candidate " onmouseover="voteDownOverFunc(' + eid + ');" onmouseout="voteDownOutFunc(' + eid + ');" onclick = "voteActFunc(' + eid + ',' + cid + ',2);">';
			
			}else{
				
				document.getElementById("imgUp_" + eid).innerHTML = '<img src="../images/up-dark.gif" border="0" id="up_thumb_id' + eid + '" style="cursor:pointer;" title=" Good Resume or Good Candidate " onmouseover="voteUpOverFunc(' + eid + ');" onmouseout="voteUpOutFunc(' + eid + ');" onclick = "voteActFunc(' + eid + ',' + cid + ',1);">';
				document.getElementById("imgDown_" + eid).innerHTML = '<img src="../images/red-hand.gif" border="0" id="down_thumb_id' + eid + '">'; 
			 
			}// end act
			  
		}// end doc result
	}// end doc
	
}// end func

function usersDivFunc(eid,cid,evt,act){
	//alert('here');
	if(evt == 1){
		if(act == 1){
			document.getElementById("upDivUsers_" + eid).innerHTML = '<div style="text-align:left; padding:80px 0px 0px 60px; color:green; font-size:10px;"><img src="../images/pre_loader.gif" border="0">&nbsp;&nbsp;Loading...</div>';
			document.getElementById("upDivUsers_" + eid).style.display = '';
		}else{
			document.getElementById("downDivUsers_" + eid).innerHTML = '<div style="text-align:left; padding:80px 0px 0px 60px; color:green; font-size:10px;"><img src="../images/pre_loader.gif" border="0">&nbsp;&nbsp;Loading...</div>';
			document.getElementById("downDivUsers_" + eid).style.display = '';
		}
		hXmlHttp1 = getXMLHttpHandler();
		hXmlHttp1.onreadystatechange = function(){		
			if(hXmlHttp1.readyState == 4){			
				if(hXmlHttp1.status == 200){
					resText = hXmlHttp1.responseText;
					if(act == 1)
						document.getElementById("upDivUsers_" + eid).innerHTML = resText;
					else
						document.getElementById("downDivUsers_" + eid).innerHTML = resText;
				}// end 200
			}// end 4
		}// end func		
		url = "common_script.cfm?key=2&eid=" + eid + "&cid=" + cid + "&act=" + act;
		//window.open(url);
		//document.write(url);
		hXmlHttp1.open("GET", url);
		hXmlHttp1.send(null);
		
	}else{
		if(act == 1)
			document.getElementById("upDivUsers_" + eid).style.display = 'none';
		else
			document.getElementById("downDivUsers_" + eid).style.display = 'none';
	}// end if
	
}// end func

function closeUserDiv(eid){
		if(document.getElementById("upDivUsers_" + eid).style.display == '')
			document.getElementById("upDivUsers_" + eid).style.display = 'none';
		if(document.getElementById("downDivUsers_" + eid).style.display == '')
			document.getElementById("downDivUsers_" + eid).style.display = 'none';	
}// end func