/*Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt */


function getResponse( i,id,response,vote,c,ip ) //getResponse( i,response, faqid, catid, user )
{
	var path = document.getElementById('path').value;
	var res	  = response;
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}



ajaxRequest.onreadystatechange = function(){
			if(ajaxRequest.readyState == 4){
				var text = ajaxRequest.responseText;

				 if(c==1){
					var ajaxDisplay = document.getElementById('je-responselike');
					ajaxDisplay.innerHTML = text;
					var alert= document.getElementById('je_already_added_like').value;
					if(alert == 0){
						document.getElementById('already_like').style.display='block';
						return false;
					}


				}
				if(c==2){
				 	var ajaxDisplay = document.getElementById('je-responsedlike');
					ajaxDisplay.innerHTML = text;
					var alert= document.getElementById('je_already_added_dlike').value;
					if(alert == 0){
						document.getElementById('already_like').style.display='block';
						return false;
					}
				}



			}
		}




if ( c == '1') {
	var votetxt = document.getElementById('like'+i).innerHTML;
	document.getElementById('je-responselike').innerHTML='<img src="'+path+'plugins/content/wdc_assets/cimages/ajax-loader_blue.gif" title="loader">';
	var url=path+'index.php?option=com_wdclikedislike&view=wdclikedislike&task=response_like&id='+id+'&lvote='+response+'&ltext='+votetxt+'&ip='+ip+'&artid='+id;
}
if ( c == '2') {
	var votetxt = document.getElementById('dlike'+i).innerHTML;
	document.getElementById('je-responsedlike').innerHTML='<img src="'+path+'plugins/content/wdc_assets/cimages/ajax-loader_red.gif" title="loader">';
	var url=path+'index.php?option=com_wdclikedislike&view=wdclikedislike&task=response_dlike&id='+id+'&dvote='+response+'&dtext='+votetxt+'&ip='+ip+'&artid='+id;
}

	ajaxRequest.open("GET", url, true);
	ajaxRequest.send(null);

}


YAHOO.register("accordionview", YAHOO.widget.AccordionView, {version: "0.99", build: "33"});