function gotolink(url)
{
	
	window.location = url;
	
}

function open_win(url_add)
{
	window.open(url_add, 'welcome', 'width=600,height=600,menubar=no,status=no, location=no,toolbar=no,scrollbars=no');
}

function scrolpage(y)
{
	window.scroll(0,y); // horizontal and vertical scroll increments
}


function popupWindow(url)
{
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=No,resizable=No,copyhistory=no,width=950,height=500,screenX=150,screenY=150,top=150,left=150')
}
function popupWindow_tweet(url)
{
	window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=No,resizable=No,copyhistory=no,width=950,height=500,screenX=150,screenY=150,top=150,left=150')
}
/*==========================Rate up post============================*/

function rateup_user(deal_id)
{
	$.ajax({
	   type: "POST",
	   url:  'request_process.php?calling=2',
	   data: 'dealid='+deal_id,

	   beforeSend: function(){
		//$("#statusdiv"+card_id).html('<img src="'+js_SERVER_ADMIN_PATH+'images/wpspin_light.gif" />');
	   },

	   success: function(msg){
			//alert(msg);
			
			$('#rate_down_div_'+deal_id).html(msg);
			refresh_counter(deal_id);
			

		},
		error: function() {
				//alert('Error Occured in Deletion.');
		}
	});
}
/*==========================Rate Down post============================*/

function ratedown_user(deal_id)
{
	$.ajax({
	   type: "POST",
	   url:  'request_process.php?calling=3',
	   data: 'dealid='+deal_id,

	   beforeSend: function(){
		//$("#statusdiv"+card_id).html('<img src="'+js_SERVER_ADMIN_PATH+'images/wpspin_light.gif" />');
	   },

	   success: function(msg){
			//alert(msg);
			$('#rate_down_div_'+deal_id).html(msg);
			refresh_counter(deal_id);
			
		},
		error: function() {
				//alert('Error Occured in Deletion.');
		}
	});
}
/*================================rate_down counter==================*/

function refresh_counter(deal_id)
{
	$.ajax({
	   type: "POST",
	   url:  'request_process.php?calling=4',
	   data: 'dealid='+deal_id,

	   beforeSend: function(){
		//$("#statusdiv"+card_id).html('<img src="'+js_SERVER_ADMIN_PATH+'images/wpspin_light.gif" />');
	   },

	   success: function(msg){
			//alert(msg);
			
			$('#before_rating_'+deal_id).hide();
			$('#ratecouter_id_'+deal_id).show();
			$('#ratecouter_id_'+deal_id).html(msg);


			
			
			
		},
		error: function() {
				//alert('Error Occured in Deletion.');
		}
	});
}


/*============================= Submit Deal ======================*/


function validate_deal()
{

	$('#dealfrm').unbind('submit');
	var options = {
	target: '#deal_error', 				// target element(s) to be updated with server response
	beforeSubmit: showdealRequest, 	
	success: showdealResponse, 		
	url: 'request_process.php?calling=1'
	};
	$('#dealfrm').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

function showdealRequest(formData, jqForm, options)
{
	var queryString = $.param(formData);
	$("#add").attr("disabled","disabled");
	return true;
	
}

function showdealResponse(responseText, statusText)
{	
	if(responseText == 'Done')
	{
		$("#deal_error").hide();
		
	}
	else
	{
		$("#add").removeAttr("disabled");
		$("#deal_error").show();
	}

}


/*============================= Submit Comments ======================*/


function validate_comments()
{

	$('#comm_frm').unbind('submit');
	var options = {
	target: '#error_div', 				// target element(s) to be updated with server response
	beforeSubmit: showcommentRequest, 	
	success: showcommentResponse, 		
	url: 'request_process.php?calling=5'
	};
	$('#comm_frm').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

function showcommentRequest(formData, jqForm, options)
{
	var queryString = $.param(formData);
	$("#addcomm").attr("disabled","disabled");
	return true;
	
}

function showcommentResponse(responseText, statusText)
{	
	if(responseText == 'Thanks for contributing,your comment post successfully')
	{
		$("#error_div").show();
		$("#fields").hide();
	}
	else
	{
		$("#addcomm").removeAttr("disabled");
		$("#error_div").show();
		
	}

}


/*=============================Comment Hide ans show===============================*/

function visible(value) 
{
	var val = value;
	document.getElementById('comm_id_'+val).style.display   = 'block';
	document.getElementById('com_id_'+val).style.display   = 'block';
	
	
}

function hide(value) 
{
	var val = value;
	document.getElementById('comm_id_'+val).style.display   = 'none';
	document.getElementById('com_id_'+val).style.display   = 'none';

	
}
