
function getRegion(id){
	var div =  $("span#waitImg").html("<img src='"+webroot_for_js+"img/loading.gif'/>");
	$.post(webroot_for_js+'FLV/getregion', {'id': id}, function(data)
	{
		$("span#region").html(data);
		$("span#waitImg").html('');
	});
}

function getRegioninDiv(id, region_id){
	var div =  $("td#waitImg").html("<img src='"+webroot_for_js+"img/loading.gif'/>");
	$.post(webroot_for_js+'home/getregion', {'id': id,'region_id': region_id}, function(data)
	{
		$("div#region").html(data);
		$('#ExposDiv').html('');
		$("td#waitImg").html('');
	});
}
function getRegioninDiv2(id, region_id){
	var div =  $("td#waitImg").html("<img src='"+webroot_for_js+"img/loading.gif'/>");
	$.post(webroot_for_js+'home/getregion2', {'id': id,'region_id': region_id}, function(data)
	{
		$("div#region").html(data);
		$("td#waitImg").html('');		
	});
}
function getRegioninDiv1(id, region_id, select_id, num){
		if(id!='')
		{
	var div =  $("span#waitImg"+region_id).html("<img src='"+webroot_for_js+"img/loading.gif'/>");
	$.post(webroot_for_js+'advertise/getregion/'+select_id+'/'+num, {'id': id,'region_id': region_id}, function(data)
	{
		$("div#region"+region_id).html(data);
		
		$("span#waitImg"+region_id).html('');
	});
	}
}
function getRegioninDiv_advertise(id, region_id, select_id, num){
		if(id!='')
		{
	var div =  $("span#waitImg"+region_id).html("<img src='"+webroot_for_js+"img/loading.gif'/>");
	$.post(webroot_for_js+'advertise/getregion_advertise/'+select_id+'/'+num, {'id': id,'region_id': region_id}, function(data)
	{
		$("div#region"+region_id).html(data);
		
		$("span#waitImg"+region_id).html('');
	});
	}
}
function getRegioninDiv2(id, region_id, select_id, num){
		if(id!='')
		{
	var div =  $("span#waitImg"+region_id).html("<img src='"+webroot_for_js+"img/loading.gif'/>");
	$.post(webroot_for_js+'advertise/getregion2/'+select_id+'/'+num, {'id': id,'region_id': region_id}, function(data)
	{
		$("div#region"+region_id).html(data);
		
		$("span#waitImg"+region_id).html('');
	});
	}
}


 function status(controller,action,Itemid,ItemValue,ItemContainer){
	
		
		$("#"+ItemContainer).html("<img src='"+webroot_for_js+"img/loading.gif' border=0 />");
	
		var url=webroot_for_js+controller+"/"+action+"/"+Itemid+"/"+ItemValue+"/"+ItemContainer;
		$.post(url, {
											id: Itemid,
											status: ItemValue
											},function(data) {
	
					                
	
						  $("#"+ItemContainer).empty();
						   $("#"+ItemContainer).html(data);
					   
					   
				   });
		return false;
	}
	
	
function checknummsp(e)
{

	evt=e || window.event;
	var keypressed=evt.which || evt.keyCode;
	//alert(keypressed);
	if(keypressed!="48" &&  keypressed!="49" && keypressed!="50" && keypressed!="51" && keypressed!="52" && keypressed!="53" && keypressed!="54" && keypressed!="55" && keypressed!="8" && keypressed!="56" && keypressed!="57" && keypressed!="45" && keypressed!="46" && keypressed!="37" && keypressed!="39" && keypressed!="9")
	{
 		return false;
	}	
}

function selectAll(commonid,thisid){
	
	if($("input[type=checkbox][id="+thisid+"]").is(':checked')){
	$("input[type=checkbox][id^="+commonid+"]").attr('checked',true);
	}else{
	$("input[type=checkbox][id^="+commonid+"]").attr('checked',false);
	}
}
function resetfrm(frmid){
	$('form#'+frmid).get(0).reset();
}

function deleteAll(model,frmid){
		$("input#"+model+"Edit").val("");
		$("input#"+model+"Delete").val("");
		$("input#"+model+"Search").val("");
		$("input#"+model+"Add").val("");
		if($("input[type=checkbox][id^="+model+"][id$=Id]:checked").length== 0){
			alert('Please select at least one Item to delete');	
		}else{
			if(confirm('Are you sure, do you want to delete?')){
				$("input#"+model+"Delete").val("Delete");
				$('form#'+frmid).submit();
			}
		}
	
}
function resetfrm(frmid){
	$('form#'+frmid).get(0).reset();
}
