
// function for email automation

function confirmautomation(path,msgcode)
{
	var msg;
	if(msgcode==1)
	 	msg=captable[426];
	else
		msg=captable[427];
	 
	ErmJS.Controls.confirm({
       text: msg,
       okFunction: function() {
       window.location=arguments[0];
       }.pass(path)
    });
}

function confirmlisting(path)
{
	 if(confirm(captable[498]))
	 {
	 window.location=path;
	 }
}

// function to flag ad

function flagad(path){
	with(window.document.frmresultsdetail){
		var errmsg='';
		var focuson;
		if(flag.selectedIndex==0)
		{
			errmsg=errmsg+captable[817];
			focuson = typeof(focuson)=="object" ? focuson : flag;
		}	
		if(trim(reason.value)=="" || trim(reason.value) == captable[850])
		{
			errmsg=errmsg+'\n'+captable[813];
			focuson = typeof(focuson)=="object" ? focuson : reason;
		}
		if(errmsg!='')
		{
			alert(errmsg);
			focuson.focus();
		}
		else
		{
			action=path+"?flagcode="+flag.options[flag.selectedIndex].value
			submit();
		}
	}	
}

// function to display popup after sending flag
function sendflag(path){
		alert(captable[570]);
		window.location=path;
}

// flag from interest detail page

function flagad1(path){
	with(window.document.frminterestdetail){
		var errmsg='';
		var focuson;
		if(flag.selectedIndex==0)
		{
			errmsg=errmsg+captable[817];
			focuson = typeof(focuson)=="object" ? focuson : flag;
		}	
		if(trim(reason.value)=="" || trim(reason.value) == captable[850])
		{
			errmsg=errmsg+'\n'+captable[813];
			focuson = typeof(focuson)=="object" ? focuson : reason;
		}
		if(errmsg!='')
		{
			alert(errmsg);
			focuson.focus();
		}
		else
		{
			action=path+"?flagcode="+flag.options[flag.selectedIndex].value
			submit();
		}
	}	
}

// flag from message detail page

function flagad2(path){
	with(window.document.frmmaildetail){
		var errmsg='';
		var focuson;
		if(flag.selectedIndex==0)
		{
			errmsg=errmsg+captable[817];
			focuson = typeof(focuson)=="object" ? focuson : flag;
		}	
		if(trim(reason.value)=="" || trim(reason.value) == captable[850])
		{
			errmsg=errmsg+'\n'+captable[813];
			focuson = typeof(focuson)=="object" ? focuson : reason;
		}
		if(errmsg!='')
		{
			alert(errmsg);
			focuson.focus();
		}
		else
		{
			action=path+"?flagcode="+flag.options[flag.selectedIndex].value
			submit();
		}
	}	
}

function flagad3(path){
	with(window.document.frmsendmail){
		var errmsg='';
		var focuson;
		if(flag.selectedIndex==0)
		{
			errmsg=errmsg+captable[817];
			focuson = typeof(focuson)=="object" ? focuson : flag;
		}	
		if(trim(reason.value)=="" || trim(reason.value) == captable[850])
		{
			errmsg=errmsg+'\n'+captable[813];
			focuson = typeof(focuson)=="object" ? focuson : reason;
		}
		if(errmsg!='')
		{
			alert(errmsg);
			focuson.focus();
		}
		else
		{
			action=path+"?flagcode="+flag.options[flag.selectedIndex].value
			submit();
		}
	}	
}

function deleteaccount(path) 
{
     ErmJS.Controls.confirm({
        text: captable[1217],
        okFunction: function() {
        window.location=arguments[0];
        }.pass(path)
     });
}
