function SubmitForRequestFor(d,formname,filename)
{
	
	try
	{
		var geturl='';
		var i=0;
		var error='';

		if(formname=='REQUESTFORM'){
			var oppmid=$("#OID").val();
			var action=$("#ACTION").val();
		}else if(formname=='frmReferee'){
			var oppmid=$("#id").val();			
		}
		var rfor=$("#REQUESTFOR").val();
		var chkbox = $('#chkreference').find("input[type=checkbox]");
		chkbox.each(function(){				
			if($(this).is(':checked')) {
				i++;
				if($('#chkrelative').is(':checked')) {
					var relative=$('#chkrelative').val();
					geturl="chkrelative="+relative;
				}				
				if($('#chkfriend').is(':checked'))	{
					var friend=$('#chkfriend').val();
					if(geturl!='') {
						geturl=geturl+"&chkfriend="+friend;
					} else {
						geturl='';
						geturl="chkfriend="+friend;
					}				
				}
				if($('#chkcolleague').is(':checked')) {
					var colleague=$('#chkcolleague').val();
					if(geturl!='') {
						geturl=geturl+"&chkcolleague="+colleague;
					} else {
						geturl='';
						geturl="chkcolleague="+colleague;
					}											
				}				
			}			
		});		
		if(($('#wid').is(':checked')) == true)
			radioval = "NO";
		else
			radioval = "YES";		
		
		
		url="/request/"+filename;
		if(filename=='bmrequestfor.php') {
			params1="WID="+radioval+"&OID="+oppmid+"&REQUESTFOR="+rfor+"&ACTION="+action;
			jqajaxRequest(url,'POST',params1,'cboxLoadedContent');
			$.colorbox.resize();
		} else if(filename=='bmrequestreferenceandvoice.php' && i>0){
			if(geturl=='')params1="WID="+radioval+"&id="+oppmid+"&REQUESTFOR="+rfor;
			else{					
				params1="WID="+radioval+"&id="+oppmid+"&REQUESTFOR="+rfor+"&"+geturl;
			}			
			jqajaxRequest(url,'POST',params1,'cboxLoadedContent');
			$.colorbox.resize();
		} else {
			errortxt="Please choose whose reference you would like to view.";
			$("#thruerror").html(errortxt);	
			$.colorbox.resize();
		}
	}catch(e){}
}
