
function ajaxRequest(process,divname,arg1,arg2,arg3){ 
	var str = location.href;
	var str1 = str.split("/",4);
	var homePage = str1[0]+"//"+str1[2]; //LOCAL
	//var homePage = str1[0]+"//"+str1[2]+"/"+str1[3]; //LOCAL

	if(process == 'CheckNLEmailExist'){

		txtValue	= document.getElementById(arg1).value;
		
		if(txtValue==""){
			qstr 	= 'p=' + escape(process) + '&email=' + escape(txtValue) + '&check=' + 'null';  
		
		}else{
			qstr 	= 'p=' + escape(process) + '&email=' + escape(txtValue);  
		}

		xmlhttpPost(homePage+'/includes/common_ajax.php',divname,qstr,homePage);
		
	}else 
	
	if(process == 'MagzOldCommentPagenation'){		
	
		var magzID	= arg1;
		var artID	= arg2;

		var minLimit = document.getElementById('hidMinLimit').value;
		minLimit = parseInt(minLimit)+5;

		qstr 	= 'p=' + escape(process) + '&mID=' + escape(magzID)  + '&aID=' + escape(artID) + '&minLimit=' + escape(minLimit);  
		xmlhttpPost(homePage+'/includes/common_ajax.php',divname,qstr,homePage);
		
	}else 
	
	if(process == 'MagzNewCommentPagenation'){			

		var magzID	= arg1;
		var artID	= arg2;

		var minLimit = document.getElementById('hidMinLimit').value;
		minLimit = parseInt(minLimit)-5;

		qstr 	= 'p=' + escape(process) + '&mID=' + escape(magzID)  + '&aID=' + escape(artID) + '&minLimit=' + escape(minLimit);  
		
		xmlhttpPost(homePage+'/includes/common_ajax.php',divname,qstr,homePage);
	}else 
	
	if(process == 'NewsOldCommentPagenation'){		

		var newsID	= arg1;

		var minLimit = document.getElementById('hidMinLimit').value;

		minLimit = parseInt(minLimit)+5;

		qstr 	= 'p=' + escape(process) + '&nID=' + escape(newsID) + '&minLimit=' + escape(minLimit);  
		
		xmlhttpPost(homePage+'/includes/common_ajax.php',divname,qstr,homePage);
	}else 

	if(process == 'NewsNewCommentPagenation'){			

		var newsID	= arg1;

		var minLimit = document.getElementById('hidMinLimit').value;
		
		minLimit = parseInt(minLimit)-5;

		qstr 	= 'p=' + escape(process) + '&nID=' + escape(newsID) + '&minLimit=' + escape(minLimit);  
		
		xmlhttpPost(homePage+'/includes/common_ajax.php',divname,qstr,homePage);
	}else 
	
	if(process == 'VideoOldCommentPagenation'){		
	
		var vidID	= arg1;

		var minLimit = document.getElementById('hidMinLimit').value;
		minLimit = parseInt(minLimit)+5;

		qstr 	= 'p=' + escape(process) + '&vID=' + escape(vidID) + '&minLimit=' + escape(minLimit);  

		xmlhttpPost(homePage+'/includes/common_ajax.php',divname,qstr,homePage);
		
	}else 
	
	if(process == 'VideoNewCommentPagenation'){			

		var vidID	= arg1;

		var minLimit = document.getElementById('hidMinLimit').value;
		minLimit = parseInt(minLimit)-5;

		qstr 	= 'p=' + escape(process) + '&vID=' + escape(vidID) + '&minLimit=' + escape(minLimit);  
		
		xmlhttpPost(homePage+'/includes/common_ajax.php',divname,qstr,homePage);
	}else 
		
	if(process == 'Postcomment')
	{
		txtValue	= document.getElementById(arg1).value;
		ccode		= document.getElementById('ccode').value;
        txtValue1 		= document.getElementById(arg2).value;
		
		if(txtValue==""){
			qstr 	= 'p=' + escape(process) + '&comments=' + escape(txtValue) + '&ccode' + escape(txtValue1) + '&check=' + null;     
		}else{
			qstr 	= 'p=' + escape(process) + '&comments=' + escape(txtValue) + '&ccode=' + escape(txtValue1) ;  
		}


		xmlhttpPost(homePage+'/includes/common_ajax.php',divname,qstr,homePage);
		document.getElementById("comments").value = '';
	    document.getElementById("ccode").value = '';
    }else 
	
	if(process == 'Interviewcomment')	{
		
		txtValue	= document.getElementById(arg1).value;
		ccode		= document.getElementById('ccode').value;
        txtValue1 		= document.getElementById(arg2).value;
		
		if(txtValue==""){
			qstr 	= 'p=' + escape(process) + '&comments=' + escape(txtValue) + '&ccode' + escape(txtValue1) + '&check=' + null;  
		}else{
			qstr 	= 'p=' + escape(process) + '&comments=' + escape(txtValue) + '&ccode=' + escape(txtValue1) ;  
      	}
  	
		xmlhttpPost(homePage+'/includes/common_ajax.php',divname,qstr,homePage);

    }else 
	
	if(process == 'Postvoting')	{
	
		document.getElementById('pollques').style.display = 'none'; 
     
		qstr 	= 'p=' + escape(process) + '&optionID=' + escape(arg1)+ '&pollId=' + escape(arg2);  
			
		xmlhttpPost(homePage+'/includes/common_ajax.php',divname,qstr,homePage);
		
	}

}


function xmlhttpPost(strURL,divname,qstr,homePage)
 {	

   var xmlHttpReq = false;
    var self = this;
    
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
	
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	
    self.xmlHttpReq.onreadystatechange = function() {
		
        if (self.xmlHttpReq.readyState == 4) {
			
			var temp = self.xmlHttpReq.responseText;			
			
			if( temp.search(/NLSUCCESS/i) >= 1 ){	
			
				window.location = homePage+"/thankyou.php?msg=2";

			}else{
				updatePage(temp,divname);
			}			
		}
    }
    self.xmlHttpReq.send(qstr);	 
}



function updatePage(txtvalue,divname)
{ 

	if(divname){
		document.getElementById(divname).innerHTML="";
		document.getElementById(divname).innerHTML=txtvalue;
	}
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
