var v_Tot_Records="", fname="" ,refoldpage,sa="", V_Show_All, JSG_alldivs="", JSG_cp="", JSG_akk="http://imgs.bharatmatrimony.com", v_Req_Type, v_View_Type, v_File_Name, parameters="", checkcnt, param_delete="", chkval="", lastRequestedURL="";
var curDomain=document.domain;

function tabNavigate(typ, seltabid)
{	
	if(typ == 1)
	{
		var tabArr = new Array("tabN", "tabNR", "tabR", "tabD", "tabF");
		inbcat = "recd";
		v_File_Name = "inbreceivedall.php";
	}
	else if(typ == 2)
	{
		var tabArr = new Array("tabRp", "tabR", "tabUR", "tabD");
		inbcat = "sent";
		v_File_Name = "inbsentall.php";
	}

	for(var i=0; i<tabArr.length; i++)
	{
		if(tabArr[i] == seltabid)  
		{
			dgebid(seltabid).className = 'active';  
			rq = v_Req_Type = seltabid.substring(3); 
			//SendHTTPRequest('http://'+curDomain+'/inbox/'+v_File_Name+'?rand='+genNumbers()+'&rq='+v_Req_Type+'&viewtype='+v_View_Type+'&loadpage='+loadpagenum, inbbasicView);
			//jqajaxRequest('http://<?=$serverName?>/inbox/inbsentall.php','GET','rq=Rp&amp;viewtype=1&amp;inbcat=sent&amp;rtype=ajax&amp;ajax=No','rcontent');
			//jqajaxRequest('http://<?=$serverName?>/inbox/inbreceivedall.php','GET','rq=F&amp;viewtype=1&amp;inbcat=recd&amp;rtype=ajax&amp;ajax=No','rcontent');
			
			dgebid("rcontent").innerHTML =	"<center><img src='http://imgs.tamilmatrimony.com/bmimgs/small_loading.gif'></center>";
			SendHTTPRequest('http://'+curDomain+'/inbox/'+v_File_Name+'?rand='+genNumbers()+'&rq='+v_Req_Type+'&viewtype='+v_View_Type+'&loadpage=1', inbbasicView);
		}
		else
			dgebid(tabArr[i]).className = 'inactive';
	}
}

function delselected(servername, inbcategory, matid)
{	
	checkcnt=countallcheck();  
	if(checkcnt>0)
	{
		param_delete="delid="+chkval+"&inbcat="+inbcategory+'&rand='+genNumbers();
		dgebid("deleteall").className = "litebox cboxElement paddr5";
		dgebid("errdiv").innerHTML = dgebid("errdiv1").innerHTML = "";

		url = 'http://'+servername+'/inbox/inbdelete.php?'+param_delete;

		//$("#deleteall").attr("class","litebox");
		//$("#deleteall1").attr("class","litebox");
		//$(".litebox").attr('href',url);	
		//$(".litebox").colorbox($.extend({}, getParameters()));

		$("#deleteall").attr('class','litebox cboxElement');		
		$("#deleteall").attr('href',url);
		$("#deleteall1").attr('class','litebox cboxElement');		
		$("#deleteall1").attr('href',url);
		$(".litebox").colorbox($.extend({}, getParameters()));  
		$(".litebox").colorbox({

		onLoad:function(){ 	
		$("#cboxClose").remove();
		var $close = $('<div id="cboxClose" style="" onclick="$.colorbox.close();refreshMainWindow();" class="">close</div>').appendTo('#cboxContent');		
		},			

		onClosed:function(){ 	
			$("#deleteall").attr('href','javascript:void(0)');
			$("#deleteall").attr('class','');
			$("#deleteall1").attr('href','javascript:void(0)');
			$("#deleteall1").attr('class','');
		}
	});
		//dgebid("deleteall").href = 'http://'+servername+'/inbox/inbdelete.php?delid='+chkval+'&inbcat='+inbcategory+'&matid='+matid;		//href="http://<?=$serverName?>/inbox/inbdelete.php?delid=<?=$id[$from[$i]."_".$i]?>&amp;inbcat=sent_<?=$_REQUEST['rq']?>&amp;matid=<?=$from[$i]?>&amp;trand=sr30we"
		//jqajaxRequest('http://'+servername+'/inbox/inbdelete.php','GET','rq=N&amp;viewtype=1&amp;inbcat=recd&amp;rtype=ajax&amp;ajax=No','rcontent');"
		//$("inbpaging").innerHTML="<center><img src='http://imgs.tamilmatrimony.com/bmimages/small_loading.gif'></center>";
		//$("inbpaging1").innerHTML="<center><img src='http://imgs.tamilmatrimony.com/bmimages/small_loading.gif'></center>";
		//fade(hidediv,'fadediv','dispdiv','500','','','http://'+curDomain+'/inbox/inbdelete.php?'+param_delete,'','dispcontent','','refreshMainWindow');
	}
	else
	{ 
		dgebid("errdiv").innerHTML="Please select the profile(s) you wish to delete";
		dgebid("errdiv1").innerHTML="Please select the profile(s) you wish to delete";
	}
}

function delsel(obj,inbcategory,linkid,maid,todel)
{ 
	//dgebid("inbpaging").innerHTML="<center><img src='http://imgs.tamilmatrimony.com/bmimgs/small_loading.gif'></center>";
	//dgebid("inbpaging1").innerHTML="<center><img src='http://imgs.tamilmatrimony.com/bmimgs/small_loading.gif'></center>";
	var param_delete="delid="+todel+"&inbcat="+inbcategory+"&matid="+maid;
	var inbdelurl = "http://"+curDomain+"/inbox/inbdelete.php?"+param_delete;  
	
	$("#"+linkid).attr('class','litebox cboxElement');		
	$("#"+linkid).attr('href',inbdelurl);
	$(".litebox").colorbox($.extend({}, getParameters()));  
	$(".litebox").colorbox({
		onLoad:function(){ 	
		$("#cboxClose").remove();
		var $close = $('<div id="cboxClose" style="" onclick="$.colorbox.close();refreshMainWindow();" class="">close</div>').appendTo('#cboxContent');		
		},			
		onClosed:function(){ 	
			$("#"+linkid).attr('href','javascript:void(0)');
			$("#"+linkid).attr('class','');
		}
	});
}

function countallcheck()
{ 
	var totelement=document.receivedfrm.elements.length;
	var chkcount=0; chkval="";
	for(var i=0;i<totelement;i++)
	{ 
		var e=document.receivedfrm.elements[i];
		if(e.type=='checkbox'&&e.name.indexOf('del[]')!=-1)
		{ 
			if(document.receivedfrm.elements[i].checked==true)
			{ 
				chkcount++;
				if(chkval=="")
				{ 
					chkval=document.receivedfrm.elements[i].value;
				}
				else
				{ 
					chkval=chkval+"~"+document.receivedfrm.elements[i].value;
				}
			}
		}
	}	
	return chkcount;
}

function checkallcheck()
{ 
	var totelement=document.receivedfrm.elements.length;
	for(var i=0;i<totelement;i++)
	{ 
		var e=document.receivedfrm.elements[i];
		if(e.type=='checkbox'&&e.name.indexOf('del[]')!=-1)
		{ 
			if(e.checked==false)
			{ 
				document.receivedfrm.selall.checked=false;
				document.receivedfrm.selall1.checked=false;
				return false;
			}
			else
			{ 
				document.receivedfrm.selall.checked=true;
				document.receivedfrm.selall1.checked=true;
			}
		}
	}
}

function selallcheck()
{ 
	var totelement=document.receivedfrm.elements.length;
	for(var i=0;i<totelement;i++)
	{ 
		var e=document.receivedfrm.elements[i];
		if(e.type=='checkbox'&&e.name.indexOf('del[]')!=-1)
		{ 
			if(document.receivedfrm.selall.checked==true)
			{ 
				e.checked=true;
				document.receivedfrm.selall1.checked=true;
				dgebid("errdiv").innerHTML="";
				dgebid("errdiv1").innerHTML="";
			}
			else
			{ 
				e.checked=false;
				document.receivedfrm.selall1.checked=false;
			}
		}
	}
}

function selallcheck1()
{ 
	var totelement=document.receivedfrm.elements.length;
	for(var i=0;i<totelement;i++)
	{ 
		var e=document.receivedfrm.elements[i];
		if(e.type=='checkbox'&&e.name.indexOf('del[]')!=-1)
		{ 
			if(document.receivedfrm.selall1.checked==true)
			{ 
				e.checked=true;
				document.receivedfrm.selall.checked=true;
				dgebid("errdiv").innerHTML="";
				dgebid("errdiv1").innerHTML="";
			}
			else
			{ 
				e.checked=false;
				document.receivedfrm.selall.checked=false;
			}
		}
	}
}

















// Page Navigation Related Stuff Start

function displayLink() 
{
	var pretext="Prev";
	var nexttext="Next";
	var next_content="",prev_content="";page_str="";st_pg_val="";end_pg_val="";gotoInbTopcontent="";gotoInbBottomcontent="";
	var gotoclass='';
	if(parseInt(JSG_alldivs)!=0)
	{
  	    Jsg_total_pages=JSG_alldivs;
		if(Jsg_total_pages>1 && JSG_cp < Jsg_total_pages )
		{			
			next_content="<li><a href='#top' onclick='loadprofiles("+(parseInt(JSG_cp)+1)+");' class='inactive pntr'>"+nexttext+" &raquo;</a></li>";
		}

		if(JSG_cp>1)
		{
			prev_content="<li><a href='#top' onclick='loadprofiles("+(parseInt(JSG_cp)-1)+");' class='inactive  pntr'>&laquo; "+pretext+"</a></li>";
			end_pg_val=JSG_cp*10;st_pg_val=end_pg_val-9;
		}
		else { end_pg_val=10;st_pg_val=1; }

		if(end_pg_val>JSG_alldivs){end_pg_val=JSG_alldivs;}
		page_str="<div style='margin-top: 3px;' class='fright'><ul id='pagination'>"+prev_content+inb_print_pgnav(JSG_cp)+next_content+"</ul></div>";	
	}

	if(Jsg_total_pages > 5){
		gotoInbTopcontent = "<div id='gotoInb' class='fright'><form name='goto_frmInb' id='goto_frmInb'><div class='fleft paddt2'><span> <input type=text name='gototxtInb' id='gototxtInb' class='textfield'  onKeyPress='return inb_go_entsub(event,1)'   maxlength='"+Jsg_total_pages+"' size='4' style='width: 30px; height: 15px; margin: 0px 10px'></span></div><div class='fleft'><input type='button' value='Go!'  onclick='inbgotopg(1);' class='button vsmall'></div></form></div>";

		gotoInbBottomcontent = "<div id='gotoInbbottom' class='fright'><form name='goto_frmInbbottom' id='goto_frmInbbottom'><div class='fleft paddt2'><span> <input type=text name='gototxtInbbottom' id='gototxtInbbottom' class='textfield'  onKeyPress='return inb_go_entsub(event,2)'   maxlength='"+Jsg_total_pages+"' size='4' style='width: 30px; height: 15px; margin: 0px 10px'></span></div><div class='fleft'><input type='button' value='Go!'  onclick='inbgotopg(2);' class='button vsmall'></div></form></div>";

	}

	 if($("#inbpaging"))
		$("#inbpaging").html(""+gotoInbTopcontent+""+page_str);	
	 if($("#inbpaging1"))
		$("#inbpaging1").html(""+gotoInbBottomcontent+""+page_str);	
}

function inb_go_entsub(e,vals) 
{   
	var agt, isIe, isGecko, key;var keychar;var splcheck;

	agt = navigator.userAgent.toLowerCase();
	
	isIE    = ((agt.indexOf("msie")  != -1) && (agt.indexOf("opera") == -1));
	isGecko = ((agt.indexOf('gecko') != -1) && (agt.indexOf("khtml") == -1));
	ischrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;

	if (isIE)
	{
		key = window.event.keyCode;
		if (key == 13){inbgotopg(vals);event.keyCode = 0;}
	}

	if(isGecko)
	{
		key = e.which;
		if (key == 13){inbgotopg(vals);(e.which) ? e.which : 0;return false;}
	}
	
	if(ischrome)
	{
		key = e.which;
		if (key == 13){inbgotopg(vals);(e.which) ? e.which : 0;return false;}
	}

	keychar = String.fromCharCode(key)
	splcheck = /\'|\"/
	return !splcheck.test(keychar);
}

function inb_print_pgnav(dispg_val)
{
	var print_msg="";cur_pg=dispg_val;
	if(cur_pg>3)
	{  
		var disp_pg=cur_pg;
		for(i=(parseInt(disp_pg)-2);i<=(parseInt(disp_pg)+2);i++)
		{ 
			if(i<=Jsg_total_pages)
			{ 
 				if(i==cur_pg)
				{print_msg=print_msg+"<li id='"+i+"'><a href=\"#top\" class=\"active\"  id=\"pagingdiv"+i+"link\">"+i+"</a></li>";}
				else{print_msg=print_msg+"<li id='"+i+"' style='color:#ff0000'><a href=\"#top\" class=\"inactive\" onclick=\"loadprofiles("+i+")\" id=\"pagingdiv"+i+"link\">"+i+"</a></li>";}
			}
			else
			{ 
				print_msg=print_msg+"<li id='"+i+"' style='color:#0000ff'><span class=\"hidden\" id=\"pagingdiv"+i+"link\">"+i+"</span></li>";
			}
		}
	}
	
	if(cur_pg<=3)
	{
		for(i=1;i<=5;i++)
		{
			if(i<=Jsg_total_pages)
			{
				if(i==cur_pg)
				{print_msg=print_msg+"<li id='"+i+"' style='color:#00ff00'><a href=\"#top\" class=\"active\"  id=\"pagingdiv"+i+"link\">"+i+"</a></li>";}
				else{print_msg=print_msg+"<li id='"+i+"' style='color:#ff0000'><a href=\"#top\" class=\"inactive\" onclick=\"loadprofiles("+i+")\" id=\"pagingdiv"+i+"link\">"+i+"</a></li>";}
			}
			else
			{
				print_msg=print_msg+"<li id='"+i+"' style='color:#0000ff'><span class=\"hidden\" id=\"pagingdiv"+i+"link\">"+i+"</span></li>";
			}
		}
	}
	/*if(Jsg_memberid!='' && Jsg_goto_page < parseInt(gotopagecount) && Jsg_goto_page > 1 && Jsg_tt=='one' && gotopageflag==1){*/
		print_msg+="<li>&nbsp; of &nbsp;</li><li><span  class='inactive'>"+Jsg_total_pages+"</span></li>";
	/*}*/
	return print_msg;
}


function inb_goto_ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function inbgotopg(vals)
{
	if(vals == 1)  var fname="gototxtInb";
	else var fname="gototxtInbbottom";

	var upg_val=inb_goto_ltrim(dgebid(fname).value, "0");

	if(IsEmpty(dgebid(fname), "text"))
	{alert("Enter page number");dgebid(fname).focus();}
	else if(upg_val=="")
	{alert("Enter page number");dgebid(fname).focus();}
	else if(!CompareValue(dgebid(fname).value,"1234567890"))
	{alert("Invalid page number");dgebid(fname).focus();}
	else
	{
	var usr_pgval=parseInt(inb_goto_ltrim(dgebid(fname).value, "0")); 
 	var tot_mod=parseInt(JSG_alldivs%10);

	if(tot_mod!=0){tot_pg=parseInt(JSG_alldivs)+1;}
	
 	if(usr_pgval > JSG_alldivs){alert ("Page number exceeding number of results");dgebid(fname).focus();}
	else
	{loadprofiles(usr_pgval);dgebid(fname).value="";}
	}
}
// Page Navigation Related Stuff End
function cookieDivUpdate()
{ 
	var cookieval=readCookie("LOGININFO"); 
	var cookiearr=cookieval.split("^|"); 
	if($("inbnewmsgdiv"))
	{ 
		if(cookiearr[17])
		{ 
			$("inbnewmsgdiv").innerHTML=cookiearr[17];
			$("inbrepmsgdiv").innerHTML=cookiearr[22];
		}
	}
}

function inbUpdateTabCnt()
{
	var getcookieurl = 'http://'+curDomain+'/inbox/inbgetcookie.php?rand='+genNumbers();

	$.ajax({
		url: getcookieurl,
		success: function(html){ 
			//37~0~4~7~26~0~155~32~42~60~21 || R Messages [37], SentMessage [155],
			var cookiearr = html.split("~"); 
			if(dgebid('totinbrecdcnt') && cookiearr[0] != ''){
				$('#totinbrecdcnt').html("("+cookiearr[0]+")");
			}
			if(dgebid('recdNcnt') && cookiearr[1] != ''){
				$('#recdNcnt').html("("+cookiearr[1]+")");
			}
			if(dgebid('recdNRcnt') && cookiearr[2] != ''){
				$('#recdNRcnt').html("("+cookiearr[2]+")");
			}
			if(dgebid('recdRcnt') && cookiearr[3] != ''){
				$('#recdRcnt').html("("+cookiearr[3]+")");
			}
			if(dgebid('recdDcnt') && cookiearr[4] != ''){
				$('#recdDcnt').html("("+cookiearr[4]+")");
			}
			if(dgebid('recdFcnt') && cookiearr[5] != ''){
				$('#recdFcnt').html("("+cookiearr[5]+")");
			}
			if(dgebid('totinbsentcnt') && cookiearr[6] != ''){
				$('#totinbsentcnt').html("("+cookiearr[6]+")");
			}
			if(dgebid('sentURcnt') && cookiearr[7] != ''){ 
				$('#sentURcnt').html("("+cookiearr[7]+")");
			}
			if(dgebid('sentRcnt') && cookiearr[8] != ''){ 
				$('#sentRcnt').html("("+cookiearr[8]+")");
			}
			if(dgebid('sentRpcnt') && cookiearr[9] != ''){
				$('#sentRpcnt').html("("+cookiearr[9]+")");
			}
			if(dgebid('sentDcnt') && cookiearr[10] != ''){
				$('#sentDcnt').html("("+cookiearr[10]+")");
			}
		}
	});
}


function readCookie(name)
{ 
	var nameEQ=name+"=";
	var ca=document.cookie.split(";");
	for(var i=0;i<ca.length;i++)
	{ 
		var c=ca[i];
		while(c.charAt(0)==" ")
			c=c.substring(1,c.length);
		if(c.indexOf(nameEQ)==0)
			return c.substring(nameEQ.length,c.length);
	}
	return"err";
}

function loadprofiles(loadpagenum)
{ 
	dgebid("rcontent").innerHTML =	"<center><img src='http://imgs.tamilmatrimony.com/bmimgs/small_loading.gif'></center>";
	SendHTTPRequest('http://'+curDomain+'/inbox/'+v_File_Name+'?rand='+genNumbers()+'&rq='+v_Req_Type+'&viewtype='+v_View_Type+'&loadpage='+loadpagenum, inbbasicView);
}

function showhidden(loadarg) 
{
	if(loadarg!='')
	{
		 dgebid(loadarg).innerHTML="<center><img src='http://imgs.tamilmatrimony.com/bmimgs/small_loading.gif'></center>";	
	} 
	else 
	{
		dgebid("inbpaging").innerHTML="<center><img src='http://imgs.tamilmatrimony.com/bmimgs/small_loading.gif'></center>";
		dgebid("inbpaging1").innerHTML="<center><img src='http://imgs.tamilmatrimony.com/bmimgs/small_loading.gif'></center>";
	}
}

function SendHTTPRequest(URL,responseFunction)
{ 
	if(dgebid("inbpaging"))
	{ 
		dgebid("inbpaging").innerHTML="<div style='text-align:center;'><img src=\"http://imgs.tamilmatrimony.com/bmimgs/small_loading.gif \"></div>";
		/*if($("inbpagingselectall"))
		{ 
			$("inbpagingselectall").style.display="none";
		}*/
		if(dgebid("inbpaging1"))
		{ 
			dgebid("inbpaging1").innerHTML="<div style='text-align:center;'><img src=\"http://imgs.tamilmatrimony.com/bmimgs/small_loading.gif \"></div>";
		}
	}
	else
	{ 
		dgebid("rcontent").innerHTML="<div style='height:300px;text-align:center;'><img src=\"http://imgs.bharatmatrimony.com/bmimgs/loading-icon.gif \"></div>";
	}
	lastRequestedURL=URL;
	$.ajax({
		url: lastRequestedURL,
		success: function(html){
			inbbasicView(html);
		}
	});
	/*var urlArr = lastRequestedURL.split("?");
	jqajaxRequest(urlArr[0], 'GET', urlArr[1], 'rcontent');*/
}

function inbbasicView(inbtxt)
{	window.scroll(0,0);
	if($("hintbox"))
	{ 
		hidetip();
	} 
	var inbsplittxt=inbtxt.split("|~|"); 
	if(inbsplittxt[6])
	{	
		cookieDivUpdate(); inbUpdateTabCnt();  
		dgebid("rcontent").innerHTML=inbsplittxt[6]; 
		JSG_alldivs=inbsplittxt[0]; 
		JSG_cp=inbsplittxt[1];
		JSG_akk="http://imgs.bharatmatrimony.com";
		v_Req_Type=inbsplittxt[2];
		v_View_Type=inbsplittxt[3];
		v_File_Name=inbsplittxt[4];
		v_Tot_Records=inbsplittxt[5];
		//alert(JSG_alldivs+"-"+JSG_cp+"-"+v_Req_Type+"-"+v_View_Type+"-"+v_File_Name);
		if(JSG_alldivs>0)
		{ 
			displayLink();
  
		}
	}
	else
	{ 
		dgebid("rcontent").innerHTML=inbtxt;
	}
}

function refreshMainWindow()
{ 
	showhidden('');
	cookieDivUpdate(); inbUpdateTabCnt();
	refoldpage=v_Tot_Records-checkcnt;
	v_Tot_Records=refoldpage;
	if((refoldpage%10==0)&&(JSG_cp>1))
	{
		JSG_cp=JSG_cp-1;
	}
	var splitedVal=lastRequestedURL.split('?');
	lastRequestedURL=splitedVal[0];	   
	SendHTTPRequest(lastRequestedURL+'?rand='+genNumbers()+'&rq='+v_Req_Type+'&viewtype='+v_View_Type+'&loadpage='+JSG_cp, inbbasicView);
}

function closeExtDiv(divid)
{
	for(var i=0; i<10; i++)
	{
		if(dgebid('extdiv'+i)) //sent
		{
			if(dgebid('extdiv'+i).innerHTML != '')
				dgebid('extdiv'+i).innerHTML = '';
		}
		if(dgebid('morediv'+i)) //received 
		{
			if(dgebid('morediv'+i).innerHTML != '')
				dgebid('morediv'+i).innerHTML = '';
			if(dgebid('repdecdiv'+i).innerHTML != '')
				dgebid('repdecdiv'+i).innerHTML = '';
		}
	}
}

function moreLinkViewMsg(msgid, sid, id, ustat)
{
	if(sid == 'sent')
		var param_more = "id="+msgid+"&sid="+sid+"&rand="+genNumbers();
	else if(sid == 'received')
		var param_more = "ustat="+ustat+"&id="+msgid+"&sid="+sid+"&rand="+genNumbers();

	var inbmoreurl = "http://"+curDomain+"/inbox/inbviewmsg.php?"+param_more;
	var linkid = "morelnk"+id;
	
	$("#"+linkid).attr('class','litebox cboxElement');		
	$("#"+linkid).attr('href',inbmoreurl);
	$(".litebox").colorbox($.extend({}, getParameters()));  
	$(".litebox").colorbox({
		onLoad:function(){ 	
		$("#cboxClose").remove();
		var $close = $('<div id="cboxClose" style="" onclick="$.colorbox.close();refreshMainWindow();" class="">close</div>').appendTo('#cboxContent');		
		},			
		onClosed:function(){ 	
			$("#"+linkid).attr('href','javascript:void(0)');
			$("#"+linkid).attr('class','');
		}
	});
}

//function to get confirmation for Mark As Spam.
function markAsSpamPrompt(msgid, recpt, memberid, setvals, type)
{
	var param = "MsgId="+msgid+"&Recepient="+recpt+"&receiver="+memberid+"&setVals="+setvals+"&Type="+type+"&rand="+genNumbers();
	var spamurl = "http://"+curDomain+"/inbox/inboxspammsg.php?"+param;
	var linkid = "markspamlnk";
	$("#"+linkid).attr('href',spamurl);
	$("#"+linkid).attr('class','litebox');		
	$(".litebox").colorbox($.extend({}, getParameters()));  
	$(".litebox").colorbox({		
		onClosed:function(){ 	
			$("#"+linkid).attr('href','javascript:void(0)');
			$("#"+linkid).attr('class','');
		}
	});
}

//function called after member chooses in Yes in confirmation (Marked As Spam)
function markedAsSpam(msgid, sender, receiver, setvals, type)
{
	var param = "msgId="+msgid+"&sender="+sender+"&receiver="+receiver+"&setVals="+setvals+"&Type="+type+"&rand="+genNumbers();
	var spamurl = "http://"+curDomain+"/inbox/inboxspammsg.php?"+param;
	
	$.ajax({
		url: spamurl,
		success: function(){
			$.colorbox.close();
			inbhideSpamDiv();
		}
	});
}

//function to hide the Mark As Spam link
function inbhideSpamDiv()
{ 
	if(dgebid("showSpamDiv"))
		dgebid("showSpamDiv").style.display='none';
}

function setPmCloseDiv(){
	$("#cboxClose").remove();
	var $close = $('<div id="cboxClose" style="" onclick="$.colorbox.close();refreshMainWindow();" class="">close</div>').appendTo('#cboxContent');
}



