function createRequestObject()
{	
	var request_o; 
	var browser = navigator.appName; 
	if(browser == "Microsoft Internet Explorer")
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	else		
		request_o = new XMLHttpRequest();	
	return request_o; 
}

var http = createRequestObject(); 


function call_show_sub_comment(id,comment)
{	

	
	if(document.getElementById('div_'+comment).style.display=='none'){
		http.open('get', 'ajax_test.php?action=Show_sub_comment&obj='+id+'&comment_id='+comment);
		http.onreadystatechange = handlehandleClick;
		http.send(null);
	}
	else{
	
		document.getElementById('div_'+comment).innerHTML ="";
		document.getElementById('div_'+comment).style.display='none';
	}
}
function handlehandleClick()
{	
	
	if(http.readyState == 4)
	{	var response = http.responseText;	
		str=response.split("|||");
		
		document.getElementById(str[1]).innerHTML =str[0];
		document.getElementById(str[1]).style.display='';
		
	}
}

function call_show_blog_comment(id,comment)
{	

	
	if(document.getElementById('div_'+comment).style.display=='none'){
		http.open('get', 'ajax_test.php?action=Show_blog_comment&obj='+id+'&comment_id='+comment);
		http.onreadystatechange = handlehandleClick;
		http.send(null);
	}
	else{
	
		document.getElementById('div_'+comment).innerHTML ="";
		document.getElementById('div_'+comment).style.display='none';
	}
}


function vote_thanks(id){
	
	//alert(id);
	var ran=Math.random();
		http.open('get', 'ajax_vote.php?type=1&obj='+id+'&r='+ran);
		http.onreadystatechange = handlevote_thanks;
		http.send(null);
}
function vote_nothanks(id){
	// alert(id);
		var ran=Math.random();
		http.open('get', 'ajax_vote.php?type=0&obj='+id+'&r='+ran);
		http.onreadystatechange = handlevote_thanks;
		http.send(null);
}
function handlevote_thanks()
{	
	
	if(http.readyState == 4)
	{	var response = http.responseText;	
			
		str=response.split("|||");
		
		if(str[2]==1)
		{
			document.getElementById("block_"+str[1]).style.cursor='auto';
			document.getElementById("nothanks_"+str[1]).style.cursor='';
		document.getElementById("community-deal-rocks-count_"+str[1]).innerHTML =str[0];
		//document.getElementById("nothanks_"+str[1]).innerHTML ='No Thanks';
         
		//Effect.Appear('thanks_'+str[1]);
		//alert("Voted Successfully");
		}
		else
		{
			//alert("Already voted for this deal");
		}
		
	}

}

function handlevote_no_thanks()
{	
	
	if(http.readyState == 4)
	{	var response = http.responseText;	
			
		
		
	}
}

function check_url_validation(id){
		
		http.open('get', 'ajax_test.php?action=check_url_validation&obj='+id);
		http.onreadystatechange = handleUrl_validation;
		http.send(null);
}
function handleUrl_validation()
{	
	
	if(http.readyState == 4)
	{	var response = http.responseText;

			if(response!=1){
			document.getElementById('show_url_validation').style.display='';
			document.getElementById('show_url_validation').innerHTML ="Invalid Web Site";
			document.getElementById('url').focus();
		}
		
	}
}



function check_editor(){
		
        var id=document.getElementById("model_id").value;
    
		http.open('get', 'checkeditors.php?id='+id);
		http.onreadystatechange = handle_editor_validation;
		http.send(null);
     
}
function handle_editor_validation()
{	
	
	if(http.readyState == 4)
	{	var response = http.responseText;

			if(response==1){
			document.getElementById("divbottom").style.display='none';
            document.getElementById("divgoods").style.display='none';
            document.getElementById("divbads").style.display='none';
			document.getElementById("editor_mode").value=0;
		}
        else{
          document.getElementById("divbottom").style.display='';
            document.getElementById("divgoods").style.display='';
            document.getElementById("divbads").style.display='';
			document.getElementById("editor_mode").value=1;
            
        }
		
	}
}










function hide_error_messege(){
	document.getElementById('show_url_validation').style.display='none';
}

