function ChangeMode()
{
	document.all.edittype.value = 1 - document.all.edittype.value;
	ChangeAction();
}
function Html2Text(str)
{
    var tag="";
    var result="";
    var str2="";
    var l = "<";
    var r = ">";
    var offset1=-1;
    var offset2=-1;
    
    var temp="";
    
    str2 = str;
    
    do {
    offset1 = str2.indexOf(l);
    offset2 = str2.indexOf(r);
    
    if ( offset1 > 0 )
        { 
            temp = str2.substring(0,offset1);
			result += temp; 
			str2 = str2.substring(offset1,str2.length);
			continue;
		}
    if ( offset1 == -1 )
    {
        result +=   str2;
        break;
    }
    
    tag = str2.substring(offset1+1,offset2);
    str2 = str2.substring(offset2+1,str2.length);
    tag.toLowerCase();
    if ( tag == "br" || tag =="BR" )
        { result += "\r\n";  }
    else
        tag = "";
    }    
    while ( 1 );
    
    while ( result.indexOf("&nbsp;") != "-1" ) result = result.replace("&nbsp;"," ");
    return result;
}

function ChangeAction()
{
	if(document.all.edittype.value == "0")
	{
		document.all.typeold.style.display = "";
		document.all.typenew.style.display = "none";
		if (Editor.document.body.innerHTML!="") {
	document.SendMail.textBody1.value=Html2Text(Editor.document.body.innerHTML);
}
	}
	else if(document.all.edittype.value == "1")
	{
		document.all.typeold.style.display = "none";
		document.all.typenew.style.display = "";
			
	Editor.document.body.innerHTML=document.SendMail.textBody1.value;
	}
}

previous_index=1;

function over_change(index,src,clrOver){
		if (!src.contains(event.fromElement)) 
	 		{ 
	 		src.style.cursor = 'hand';
	 		src.bgColor = clrOver;
	 		}
}

function out_change(index,src,clrIn){
		if (!src.contains(event.toElement))
			{
			src.style.cursor = 'default';
			src.bgColor = clrIn;
			}
}

function click_change(index,src,url){
	if(previous_index>0) eval('document.all.b'+previous_index+'.bgColor="FFDB91"');
	eval('document.all.b'+index+'.bgColor="#FDC250"');
	parent.parent.location=url;
}

function sendsms(url) {
	var new3=window.open(url,"sendsms","width=360,height=330,toolbar=no,resizable=no,scrollbars=no")
}

