function isValidChar(ch) {

    var sevenbitdefault = new Array('@', '£', '$', '¥', 'è', 'é', 'ù', 'ì', 'ò', 'Ç', '\n', 'Ø', 'ø', '\r', 'Å', 'å', '\u0394', '_', '\u03a6', '\u0393', '\u039b', '\u03a9', '\u03a0', '\u03a8', '\u03a3', '\u0398', '\u039e', '€', 'Æ', 'æ', 'ß', 'É', ' ', '!', '"', '#', '¤', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '¡', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ä', 'Ö', 'Ñ', 'Ü', '§', '¿', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'ä', 'ö', 'ñ', 'ü', 'à');

    for (var i = 0; i < sevenbitdefault.length; i++) {
        if (sevenbitdefault[i] == ch)
            return true;
    }

    //also check to see if it's one of the extra 2-byte characters...
    //if(ch == '{' || ch == '}' || ch == '[' || ch == ']' || ch == '^' || ch == '~' || ch == '|' || ch == '€' || ch == '\\' )
    return ch.match(/[\{\}\[\]\\\|\€\~\^]/);


}

function GSMtoUnicode(txt) {

    var sevenbitdefault = new Array('@', '£', '$', '¥', 'è', 'é', 'ù', 'ì', 'ò', 'Ç', '\n', 'Ø', 'ø', '\r', 'Å', 'å', '\u0394', '_', '\u03a6', '\u0393', '\u039b', '\u03a9', '\u03a0', '\u03a8', '\u03a3', '\u0398', '\u039e', '€', 'Æ', 'æ', 'ß', 'É', ' ', '!', '"', '#', '¤', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '¡', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ä', 'Ö', 'Ñ', 'Ü', '§', '¿', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'ä', 'ö', 'ñ', 'ü', 'à');

    var gsmUnicodeValues = new Array(
            0x0040, 0x00A3, 0x0024, 0x00A5, 0x00E8, 0x00E9, 0x00F9, 0x00EC,
            0x00F2, 0x00E7, 0x000A, 0x00D8, 0x00F8, 0x000D, 0x00C5, 0x00E5,
            0x0394, 0x005F, 0x03A6, 0x0393, 0x039B, 0x03A9, 0x03A0, 0x03A8,
            0x03A3, 0x0398, 0x039E, 0x00A0, 0x00C6, 0x00E6, 0x00DF, 0x00C9,
            0x0020, 0x0021, 0x0022, 0x0023, 0x00A4, 0x0025, 0x0026, 0x0027,
            0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F,
            0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
            0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
            0x00A1, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
            0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
            0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
            0x0058, 0x0059, 0x005A, 0x00C4, 0x00D6, 0x00D1, 0x00DC, 0x00A7,
            0x00BF, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
            0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F,
            0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
            0x0078, 0x0079, 0x007A, 0x00E4, 0x00F6, 0x00F1, 0x00FC, 0x00E0
            );

    var result = "";

    for (var j = 0; j < txt.length; j++) {
        for (var i = 0; i < sevenbitdefault.length; i++) {

            if (sevenbitdefault[i] == txt.charAt(j))
                result += String.fromCharCode(gsmUnicodeValues[i]);

        }
    }

    return result;

}

function acceptSMSPreviewChange(){

    var originalText = document.getElementById('message').value;
    var suggestion  = document.getElementById('suggested_text').value;

    if(suggestion!=originalText){
        document.getElementById('message').value = document.getElementById('suggested_text').value;
    }

    showHide(document.getElementById('suggestions'));

    validateAll(true);
    return nd();
    //showHide(document.getElementById('illegal_chars_warning'));

}
/*
 function showPreviewIfNecessary(){
 var ill_chars = document.getElementById('illegal_characters').innerHTML;
 if(ill_chars != "" ){
 var message = document.getElementById('message');
 var x = message.pageXOffset;
 var y = message.pageYOffset;
 return overlib('<textarea disabled rows=\'9\' cols=\'30\' id=\'preview\'>' + document.getElementById('suggested_text').value + ' </textarea>' +
 '<br> <center>' +
 '<button onclick=\'acceptSMSPreviewChange();return nd();\'>Accept</button> ' +
 '</center> ', FGCOLOR, '#d9e0ba' , STICKY,  CAPTION, 'Preview SMS Text', FIXX, x + 200, FIXY, y
 );
 }
 return nd();
 }
 */
function showHide(field){
    with(field){
        if(style.visibility == 'visible'){
            style.visibility = 'hidden';
        }else{
            style.visibility = 'visible';
        }
    }
}

function UnicodeGreekToGSM(txt, elementToAttachToId, hiddenElementId, showOnClick) {

    var result = "";

    for (var j = 0; j < txt.length; j++) {

        if (isValidChar(txt.charAt(j))) {
            //result += String.toUpperCase(txt.charAt(j));
            result = (result, txt.charAt(j));
            document.getElementById(elementToAttachToId).innerHTML = (document.getElementById(elementToAttachToId).innerHTML, txt.charAt(j));
        }else{

            var code = txt.charCodeAt(j);



            if (code == 913 || code == 902 || code == 940 || code == 945) {
                result = (result+"A");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 914 || code == 946) {
                result = (result+"B");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 915 || code == 947) {
                result = (result+"Γ");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 916 || code == 948) {
                result = (result+"Δ");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 904 || code == 917 || code == 941 || code == 949) {
                result = (result+"E");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 986) {
                result = (result+"S");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 988) {
                result = (result+"F");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 918 || code == 950) {
                result = (result+"Z");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 919 || code == 942 || code == 905 || code == 951) {
                result = (result+"H");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 920 || code == 952) {
                result = (result+"Θ");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 921 || code == 953 || code == 906 || code == 938 || code == 943 || code == 970 || code == 912) {
                result = (result+"I");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 922 || code == 954) {
                result = (result+"K");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 923 || code == 955) {
                result = (result+"Λ");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 924 || code == 956) {
                result = (result+"M");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 925 || code == 957) {
                result = (result+"N");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 926 || code == 958) {
                result = (result+"Ξ");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 927 || code == 959 || code == 908 || code == 972) {
                result = (result+"O");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 928 || code == 960) {
                result = (result+"Π");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 929 || code == 961) {
                result = (result+"P");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 931 || code == 962 || code == 963) {
                result = (result+"Σ");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 932 || code == 964) {
                result = (result+"T");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 933 || code == 944 || code == 910 || code == 973 || code == 939 || code == 965 || code == 971) {
                result = (result+"Y");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 934 || code == 966) {
                result = (result+"Φ");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 935 || code == 967) {
                result = (result+"X");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 936 || code == 968) {
                result = (result+"Ψ");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            } else if (code == 937 || code == 969 || code == 974 || code == 911) {
                result = (result+"Ω");
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
            }/*else if(code == 12){                                            //FORM FEED
             result = (result,String.fromCharCode(0x1B0A);
             }else if(code == 94){                                            //CIRCUMFLEX ACCENT
             result = (result,String.fromCharCode(0x1B14);
             }else if(code == 123){                                          //LEFT CURLY BRACKET
             result = (result,String.fromCharCode(0x1B28);
             }else if(code == 125){                                          //RIGHT CURLY BRACKET
             result = (result,String.fromCharCode(0x1B29);
             }else if(code == 92){                                           //REVERSE SOLIDUS
             result = (result,String.fromCharCode(0x1B2F);
             }else if(code == 91){                                           //LEFT SQUARE BRACKET
             result = (result,String.fromCharCode(0x1B3C);
             }else if(code == 126){                                          //TILDE
             result = (result,String.fromCharCode(0x1B3D);
             }else if(code == 93){                                           //RIGHT SQUARE BRACKET
             result = (result,String.fromCharCode(0x1B3E);
             }else if(code == 124){                                         //VERTICAL LINE
             result = (result,String.fromCharCode(0x1B40);
             }else if(code == 8364){                                       //EURO SIGN
             result = (result,String.fromCharCode(0x1B65);
             }*/ else {
                /*   if (isValidChar(txt.charAt(j))) {
                 result += String.toUpperCase(txt.charAt(j));
                 document.getElementById('illegal_text').innerHTML += txt.charAt(j);
                 } else {*/
                appendToIllegalCharacters(txt.charAt(j), elementToAttachToId, showOnClick);
                //}
            }
        }
    }

    var suggestion = document.getElementById(hiddenElementId);
    suggestion.value = result;

    //suggestion.style.visibility = 'visible';

    return result;
}




var textModificationStatus = 0;        // 0 = no modifications made, 1 = corrections made, 2 = invalid characters were inserted and deleted

function simple_UnicodeGreekToGSM(txt) {

    var result = "";

    if(txt.length==0)
        textModificationStatus = 0;

    for (var j = 0; j < txt.length; j++) {

        
        if(txt.charCodeAt(j)==13){
          continue;
        }
        if (isValidChar(txt.charAt(j))) {
              result = (result+ txt.charAt(j));
            //(document.getElementById('illegal_text').innerHTML+ txt.charAt(j));
        }else{

            var code = txt.charCodeAt(j);

            if (code == 913 || code == 902 || code == 940 || code == 945) {
                result = (result+"A");
                textModificationStatus = 1;

            } else if (code == 914 || code == 946) {
                result = (result+"B");
                textModificationStatus = 1;

            } else if (code == 915 || code == 947) {
                result = (result+"Γ");
                textModificationStatus = 1;

            } else if (code == 916 || code == 948) {
                result = (result+"Δ");
                textModificationStatus = 1;

            } else if (code == 904 || code == 917 || code == 941 || code == 949) {
                result = (result+"E");
                textModificationStatus = 1;

            } else if (code == 986) {
                result = (result+"S");
                textModificationStatus = 1;

            } else if (code == 988) {
                result = (result+"F");
                textModificationStatus = 1;

            } else if (code == 918 || code == 950) {
                result = (result+"Z");
                textModificationStatus = 1;

            } else if (code == 919 || code == 942 || code == 905 || code == 951) {
                result = (result+"H");
                textModificationStatus = 1;

            } else if (code == 920 || code == 952) {
                result = (result+"Θ");
                textModificationStatus = 1;

            } else if (code == 921 || code == 953 || code == 906 || code == 938 || code == 943 || code == 970 || code == 912) {
                result = (result+"I");
                textModificationStatus = 1;

            } else if (code == 922 || code == 954) {
                result = (result+"K");
                textModificationStatus = 1;

            } else if (code == 923 || code == 955) {
                result = (result+"Λ");
                textModificationStatus = 1;

            } else if (code == 924 || code == 956) {
                result = (result+"M");
                textModificationStatus = 1;

            } else if (code == 925 || code == 957) {
                result = (result+"N");
                textModificationStatus = 1;

            } else if (code == 926 || code == 958) {
                result = (result+"Ξ");
                textModificationStatus = 1;

            } else if (code == 927 || code == 959 || code == 908 || code == 972) {
                result = (result+"O");
                textModificationStatus = 1;

            } else if (code == 928 || code == 960) {
                result = (result+"Π");
                textModificationStatus = 1;

            } else if (code == 929 || code == 961) {
                result = (result+"P");
                textModificationStatus = 1;

            } else if (code == 931 || code == 962 || code == 963) {
                result = (result+"Σ");
                textModificationStatus = 1;

            } else if (code == 932 || code == 964) {
                result = (result+"T");
                textModificationStatus = 1;

            } else if (code == 933 || code == 944 || code == 910 || code == 973 || code == 939 || code == 965 || code == 971) {
                result = (result+"Y");
                textModificationStatus = 1;

            } else if (code == 934 || code == 966) {
                result = (result+"Φ");
                textModificationStatus = 1;

            } else if (code == 935 || code == 967) {
                result = (result+"X");
                textModificationStatus = 1;

            } else if (code == 936 || code == 968) {
                result = (result+"Ψ");
                textModificationStatus = 1;

            } else if (code == 937 || code == 969 || code == 974 || code == 911) {
                result = (result+"Ω");
                textModificationStatus = 1;

            }else{  //INVALID CHARACTER!!!
                textModificationStatus = 2;
            }

        }
        //Escape logic for the dynamcic keywords
        if(txt.charCodeAt(j)==36){
    		if(txt.indexOf("}",j)>0){
    			result = (result+txt.substring(j+1,txt.indexOf("}",j)+1));
    			j = txt.indexOf("}",j);
    		}
    		
        }
    }
 /*   
    if(textModificationStatus==1){
			
			//show info that we are correcting the input text.
	    	document.getElementById('lightBulb').style.display = 'none';
	        document.getElementById('textOkIcon').style.display = 'none';
	        document.getElementById('infoDiv').style.display = 'inline';

    }else if(textModificationStatus==2){
			
			// show error div
 	        document.getElementById('lightBulb').style.display = 'inline';
	        document.getElementById('textOkIcon').style.display = 'none';
	        document.getElementById('infoDiv').style.display = 'none';
    }else if(textModificationStatus==0){

        // all text input was ok
	    	document.getElementById('lightBulb').style.display = 'none';
	        document.getElementById('textOkIcon').style.display = 'inline';
	        document.getElementById('infoDiv').style.display = 'none';

    }*/


    return result;
}



function showMessageErrors(messageElem){
    var messageText = document.getElementById(messageElem).value;
    //store to be able to restore later
    document.getElementById('originalText').value = messageText;
    document.getElementById('undoChanges').style.display = 'inline';

    //document.getElementById('showErrorsDiv').style.display = 'inline';
    //document.getElementById('errorMessageDescDiv').style.display = 'inline';
    document.getElementById('correctAllButton').style.display = 'inline';
    document.getElementById('originalMessageDiv').style.display = 'none';
}

function undoChanges(toId, fromId){
    document.getElementById(toId).value = document.getElementById(fromId).value;
    validateAll(true);
}


function showHide(l) {
    var elm = document.getElementById(l);
    if (elm == null) return;
    if (elm.style.visibility == 'visible') {
        elm.style.visibility = 'hidden';
    } else {
        elm.style.visibility = 'visible';
    }
}

function appendToIllegalCharacters(ch, elementToAttachToId, showOnClick) {

    document.getElementById('textOkIcon').style.display = 'none';
    document.getElementById('lightBulb').style.display = 'inline';
    document.getElementById('infoDiv').style.display = 'inline';
    textOK = false;
    document.getElementById('send_SMS').disabled = 'true';
    document.getElementById('scheduleSMS').disabled = 'true';


    var html = document.getElementById(elementToAttachToId).innerHTML ;

    if(html.match(/<\/span>$/)){// add to previous span..

        html = html.substring(0, html.length - 7);  //7 chars for </span>
        html+= ch + '</span>';
    }else{
        if(showOnClick){
            //html += '<span style=\'color:red;text-decoration:underline\' onclick=\'correctInText(this.innerHTML, document.getElementById("message").innerHTML)\'>' + ch + '</span>'
            //html += '<span id=\''+guid()+'\' class=\'errorInText\' onmouseover=\'changeCursor(this);\' onclick=\'showSuggestionsBox(this)\'>' + ch + '</span>'
            html += '<span id=\''+guid()+'\' class=\'errorInText\' onmouseover=\'changeCursor(this)\' onclick=\'showSuggestionsBox(this)\'>' + ch + '</span>'
        }else{
            html += '<span id=\''+guid()+'\' class=\'errorInText\'>' + ch + '</span>'
        }
    }
    document.getElementById(elementToAttachToId).innerHTML = html;
}

var lastCharCode = -1;
/** Metraei swsta ton arithmo twn xarakthrwn pou xreiazontai gia na figei ena GSM minima. Lamvanei ip'opsi
 *   ta { } [ ] ^ ~ | \ € kai ta metraei swsta gia diplous xarakthres. Gia UCS-2 minimata, i gia minimata pou den periexoun
 *   aftous tous xarakthres, apla epistrefetai to mhkos tou txt, opws afto dinetai apo thn length.
 *
 * @param txt To keimeno tou opoiou i katametrhsh GSM xarakthrwn prepei na ginei..
 */
function countChars(txt,mode) {

    var result = 0;
    var sms_type = getSmsType();

    var maxChars_GSMSMS = 300;
    var maxChars_UCS2SMS = 300;
    var maxChars_FLASHSMS = 160;


    if (sms_type == 't' || sms_type == 'f') {

        for (var i = 0; i < txt.length; i++) {

            var code = txt.charCodeAt(i);
            if (code == 12) {                                                     //FORM FEED
                result += 2;
            } else if (code == 94) {                                            //CIRCUMFLEX ACCENT
                result += 2;
            } else if (code == 123) {                                          //LEFT CURLY BRACKET
                result += 2;
            } else if (code == 125) {                                          //RIGHT CURLY BRACKET
                result += 2;
            } else if (code == 92) {                                           //REVERSE SOLIDUS
                result += 2;
            } else if (code == 91) {                                           //LEFT SQUARE BRACKET
                result += 2;
            } else if (code == 126) {                                          //TILDE
                result += 2;
            } else if (code == 93) {                                           //RIGHT SQUARE BRACKET
                result += 2;
            } else if (code == 124) {                                         //VERTICAL LINE
                result += 2;
            } else if (code == 8364) {                                       //EURO SIGN
                result += 2;
            } else if (code == 13){
              continue;
            }
            /* else if (code == 10) {                                       //handle ENTER key
                result+=2;
                if(lastCharCode==13)
                  result-=1;
            } */ 
            else {
                result++;
            }

            lastCharCode=code;

        }

        if(sms_type == 't' && result>maxChars_GSMSMS){
            //if last char was a double value char, don't allow it
            var charcode = txt.charCodeAt(maxChars_GSMSMS);
            if(!isDoubleChar(charcode)){
                txt=txt.substring(0,maxChars_GSMSMS);
                result = maxChars_GSMSMS;
            }else{
                txt=txt.substring(0,maxChars_GSMSMS-1);
                result = maxChars_GSMSMS-1;
            }
        }else if(sms_type == 'f' && result>maxChars_FLASHSMS){
            //if last char was a double value char, don't allow it
            charcode = txt.charCodeAt(maxChars_FLASHSMS);
            if(!isDoubleChar(charcode)){
                txt=txt.substring(0,maxChars_FLASHSMS);
                result = maxChars_FLASHSMS;
            }else{
                txt=txt.substring(0,maxChars_FLASHSMS-1);
                result = maxChars_FLASHSMS-1;
            }
        }

        if(mode == 1){
	        document.getElementById('message').value = txt;
	        document.getElementById('lblnum').innerHTML = result;
        }
        else if(mode == 2){
	        document.getElementById('messageEDIT').value = txt;
	        document.getElementById('lblnumEDIT').innerHTML = result;
        }
        return result;
    } else {

        if(txt.length > maxChars_UCS2SMS){
            txt=txt.substring(0,maxChars_UCS2SMS);
        }

        if(mode == 1){
	        document.getElementById('message').value = txt;
	        document.getElementById('lblnum').innerHTML = txt.length;
        }
        else if(mode == 2){
	        document.getElementById('messageEDIT').value = txt;
	        document.getElementById('lblnumEDIT').innerHTML = txt.length;
        }

        return txt.length;
    }
}

/**
 * Checks whether the specified character counts as two characters in the GSM format.
 * @param char The character to be evaluated
 */
function isDoubleChar(charcode){
    var result = false;
    if (charcode == 12) {                                                     //FORM FEED
        result = true;
    } else if (charcode == 94) {                                            //CIRCUMFLEX ACCENT
        result = true;
    } else if (charcode == 123) {                                          //LEFT CURLY BRACKET
        result = true;
    } else if (charcode == 125) {                                          //RIGHT CURLY BRACKET
        result = true;
    } else if (charcode == 92) {                                           //REVERSE SOLIDUS
        result = true;
    } else if (charcode == 91) {                                           //LEFT SQUARE BRACKET
        result = true;
    } else if (charcode == 126) {                                          //TILDE
        result = true;
    } else if (charcode == 93) {                                           //RIGHT SQUARE BRACKET
        result = true;
    } else if (charcode == 124) {                                         //VERTICAL LINE
        result = true;
    } else if (charcode == 8364) {                                       //EURO SIGN
        result = true;
    }

    return result;

}

function getSmsType() {
    var type = '';
    var types = document.getElementsByName('type');
    for (var j = 0; j < types.length; j++) {
        if (types[j].checked)
            type = types[j].value;
    }

    return type;
}

function setSmsType(value) {
    var types = document.getElementsByName('type');
    for (var j = 0; j < types.length; j++) {
        if (types[j].value === value){
            types[j].checked = true;
            return true;
        }
    }

    return false;
}



/** Metraei posa SMS tha xreiastoun apo ton epilegmeno tipo minimatos, gia na pragmatopoiithei i apostolh tou SMS.
 *   Epishs kanei update to antistoixo label, kai epistrefei ton arithmo afton gia ta SMS. O arithmos einai panta akeraios.
 *
 * @param txt To keimeno pou exei eisagei o xrhsths gia to sms.
 */
function countSMS(txt,mode) {

    var type = getSmsType();

    var concatenation = document.getElementById('opt_concat').checked;

    var chars = -1;
    var sms = -1;

    chars = countChars(txt,mode);

    if (type == 't' || type == 'f') {

        if (chars <= 160) {        //for 1 SMS
            sms = 1;
        } else {                           //for more than 1 SMS
            if(concatenation){
                var remainder = chars % 153;
                if (remainder == 0)
                    sms = chars / 153;
                else
                    sms = ( (chars - remainder) / 153 ) + 1;
            }else{
                var remainder = chars % 160;
                if (remainder == 0)
                    sms = chars / 160;
                else
                    sms = ( (chars - remainder) / 160 ) + 1;
            }
        }

    } else if (type == 'u') {

        if (chars <= 70) {        //for 1 SMS
            sms = 1;
        } else {                           //for more than 1 SMS
            if(concatenation){
                remainder = chars % 67;
                if (remainder == 0)
                    sms = chars / 67;
                else
                    sms = ( (chars - remainder) / 67 ) + 1;
            }else{
                remainder = chars % 70;
                if (remainder == 0)
                    sms = chars / 70;
                else
                    sms = ( (chars - remainder) / 70 ) + 1;
            }
        }

    }

    if(sms>1){
    	if(mode == 1)
    		document.getElementById('smsCountDiv').style.display = 'inline';
    	else if(mode == 2)
        	document.getElementById('smsCountDivEDIT').style.display = 'inline';
    
    }else{
    	if(mode == 1)
    		document.getElementById('smsCountDiv').style.display = 'none';
    	else if(mode == 2)
        	document.getElementById('smsCountDivEDIT').style.display = 'none';
    }

	if(mode == 1)
		document.getElementById('sms_count').innerHTML = sms;
	else if(mode == 2)
    	document.getElementById('sms_countEDIT').innerHTML = sms;
    
    return sms;

}
function cancelCorrectAll(){
    //document.getElementById('showErrorsDiv').style.display = 'none';
    //document.getElementById('errorMessageDescDiv').style.display = 'none';
    document.getElementById('originalMessageDiv').style.display = 'inline';
    validateAll(true);
    return false;
}

function correctAll(){
    var divHTML = document.getElementById('illegal_text').innerHTML;

    var indexOfSpan = -1;
    indexOfSpan = divHTML.indexOf('<span id=');
    while(indexOfSpan>=0){

        //toss unused html
        divHTML = divHTML.substring(indexOfSpan+10, divHTML.length);

        //find span id
        var spanId = divHTML.substring(0, divHTML.indexOf('class')-2 );

        //alert('found span id: ' + spanId + ": html: " + divHTML);

        var span = document.getElementById(spanId);
        if(span.className == 'errorInText'){
            correctInTextWithCorrection(span.innerHTML, spanId, "illegal_text", simple_UnicodeGreekToGSM(span.innerHTML));
        }

        //find next span
        indexOfSpan = divHTML.indexOf('<span id=');

    }

    areAllErrorsFixed();

    //alert('no span found?');

    /*document.getElementById('showErrorsDiv').style.display = 'none';
     document.getElementById('errorMessageDescDiv').style.display = 'none';
     document.getElementById('originalMessageDiv').style.display = 'inline';
     */

}

function areAllErrorsFixed(){
    //hide fixAll Button, if all errors fixed..
    var errorsText = document.getElementById('illegal_text').innerHTML;
    if(errorsText.indexOf('errorInText')<0)
        document.getElementById('correctAllButton').style.display = 'none';

}

function acceptCorrect(){
    var result = "";
    var divHTML = document.getElementById('illegal_text').innerHTML;

    //fix -- get rid of '[object Window]'
    /*var indexOfOW = divHTML.indexOf('[object Window]');
     if(indexOfOW>0){
     divHTML = String.concat(divHTML.substring(0,indexOfOW) , divHTML.substring(indexOfOW+15, divHTML.length));
     }else if(indexOfOW==0){
     divHTML = divHTML.substring(indexOfOW+15, divHTML.length);
     }
     */
    var indexOfSpan = -1, indexOfEndSpan = -1;
    indexOfSpan = divHTML.indexOf('<span');
    while(indexOfSpan>=0){

        //if indexOfSpan is >0, then we have valid chars before it, so store these in result...
        if(indexOfSpan>0){
            result = (result, divHTML.substring(0,indexOfSpan));
        }

        //find where span ends
        var indexOfGT = divHTML.indexOf('>');
        if(indexOfGT>=0){   //..and chop this part off (to be able to continue processing)
            //divHTML = divHTML.substring(indexOfSpan, indexOfGT+1);
            divHTML = divHTML.substring(indexOfGT+1, divHTML.length);
            indexOfEndSpan = divHTML.indexOf('</span>');

            //add to result the actual text
            result = (result, divHTML.substring(0,indexOfEndSpan));
            //chop off '</span>'
            divHTML = divHTML.substring(indexOfEndSpan+7, divHTML.length);

            //get new index
            indexOfSpan = divHTML.indexOf('<span');
        }

    }

    //add remaining text, if any, to result
    result = (result, divHTML);

    document.getElementById('message').value = result;

    //document.getElementById('showErrorsDiv').style.display = 'none';
    //document.getElementById('errorMessageDescDiv').style.display = 'none';
    document.getElementById('originalMessageDiv').style.display = 'inline';

    validateAll(true);
}

/* Geniki methodos pou kalei tis alles pou kanoun to validation tou kathe pediou, opou afto ginetai ksexwrista,
 kai
 */
function validateAll(event, dosuggestion) {
  if(event){    //IE arrow keys FIX
     var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
     if(keyCode>=37 && keyCode<=40)return;
  }

    //update char and sms count labels
    var sms_txt = document.getElementById('message');

    if(dosuggestion){
        //reset illegal chars label
        //document.getElementById('showErrorsDiv').style.display = 'none';
        //document.getElementById('errorMessageDescDiv').style.display = 'none';
        document.getElementById('lightBulb').style.display = 'none';
        document.getElementById('infoDiv').style.display = 'none';
        document.getElementById('textOkIcon').style.display = 'inline';
        textOK = true;
        if(textOK && originatorOK && recipientOK){
            document.getElementById('send_SMS').disabled= '';
            document.getElementById('scheduleSMS').disabled= '';
        }
        document.getElementById('originalMessageDiv').style.display = 'inline';
        
        //document.getElementById('illegal_text').innerHTML = '';

        //suggest GSM text, if applicable
        var sms_type = getSmsType();
        
        if (sms_type == 't'|| sms_type == 'f'){
            //UnicodeGreekToGSM(sms_txt.value, 'illegal_text', 'suggested_text', true);
            sms_txt.value = simple_UnicodeGreekToGSM(sms_txt.value);
        }

        if(sms_txt.value==null || sms_txt.value == ''){
            document.getElementById('infoDiv').style.display = 'none';
            document.getElementById('textOkIcon').style.display = 'none';
            document.getElementById('lightBulb').style.display = 'inline';
            
            textOK = false;
            
           	document.getElementById('send_SMS').disabled = 'true';
           	document.getElementById('scheduleSMS').disabled = 'true';
       
        }else{
        //  setCaretPosition("message", caretPosStart, caretPosEnd);
        }

    }
    
    countSMS(sms_txt.value,1);
};


   function validateTemplate_Tiny(text) {
	    var error = "";

	    document.getElementById('edit_Template').disabled= 'true';
	    document.getElementById('add_Template').disabled= 'true';
	    var field1 = document.getElementById("dtemplates");
	    var field2 = document.getElementById("tname");
      var field3 = document.getElementById("toriginator");

	    var nameOK = false;
	    var bodyOK = false;
	    var templateOK = false;
	    var originatorOK = false;

	    if(field1!=null){	    
	    	var opts = field1.options;
		    var hasSelected = false;
		    for(var i=0;i<opts.length;i++){
		        hasSelected |= opts[i].selected;
		    }

		    if(!hasSelected) error = " no template selected!\n";  
		    else templateOK = true;
	    }
	    
	    if(field2.value=="") error = " no template name!\n";  
	    else nameOK = true;
	    

      
      if(field3.value=="") {
        error = " no originator!\n";
        originatorOK = false;
        document.getElementById('originatorBadIcon').style.display='inline';
        document.getElementById('originatorOkIcon').style.display='none';
      }else if (!field3.value.match(/^([+]?[0-9]{10,16}|[0-9a-zA-Z!:;+.-]{0,11})$/)) {
        error=" invalid characters. \n";
        originatorOK = false;
        document.getElementById('originatorBadIcon').style.display='inline';
        document.getElementById('originatorOkIcon').style.display='none';
      }else if (field3.value.search(/\D/g) == -1) {
        if (field3.value.length > 16 || field3.value.length <10 ){  
           error=" digit-only originator too long. \n";
           originatorOK = false;
           document.getElementById('originatorBadIcon').style.display='inline';
           document.getElementById('originatorOkIcon').style.display='none';
        }else{
          error="";
          originatorOK = true;
          document.getElementById('originatorBadIcon').style.display='none';
          document.getElementById('originatorOkIcon').style.display='inline';
                                                                                                                                                                                                                      }
    } else {
       error="";
       originatorOK = true;
       document.getElementById('originatorBadIcon').style.display='none';
       document.getElementById('originatorOkIcon').style.display='inline';
   }

	    //c = tinymce.EditorManager.get("message").getContent({format : 'text'}); //tinyMCE.activeEditor.getContent({format : 'text'});
	    text = getMessageAsPlainText_Tiny(text);
	    
	    if(text=="" || text==null) error = " no template body!\n";  
	    else bodyOK = true;

	    if(nameOK && bodyOK && originatorOK) {
	    	document.getElementById('add_Template').disabled= '';
	    }
	    
	    if(templateOK && nameOK && bodyOK && originatorOK){
	    	document.getElementById('edit_Template').disabled= '';	    	
	    }
	    
	    return error;
   };


   function validateContact_Tiny() {
	    var error = "";

	    document.getElementById('edit_Contact').disabled= 'true';
	    document.getElementById('add_Contact').disabled= 'true';
	    var field1 = document.getElementById("dcontacts");
	    var field2 = document.getElementById("cmobile");

	    var mobileOK = false;
	    var contactOK = false;
	    
	    if(field1!=null){	    
	    	var opts = field1.options;
		    var hasSelected = false;
		    for(var i=0;i<opts.length;i++){
		        hasSelected |= opts[i].selected;
		    }

		    if(!hasSelected) error = " no contact selected!\n";  
		    else contactOK = true;
	    }
	    
	    if(field2.value=="") error = " no mobile name!\n";  
	    else mobileOK = true;
	    
	
	    if(mobileOK) {
	    	document.getElementById('add_Contact').disabled= '';
	    }
	    
	    if(contactOK && mobileOK){
	    	document.getElementById('edit_Contact').disabled= '';	    	
	    }
	    
	    return error;
  };

  function validateMapMobile_Tiny() {
    var error = "";
    mobileOK = false;
    
    $("#send_SMS").attr("disabled", "true");

    var $kids = $("#mheader_tr").children();
    
    for(var i=0; i<$kids.length; i++){
    	var $field =  $('#'+ $kids[i].id).children();
     	var option = $("#" + $field[0].id + " option:selected").val();
     	
    	if(option == 'mobile') {mobileOK = true; break;}
    }
    
    if(!mobileOK) error = " no contact selected!\n"; 
    
    if(mobileOK) {
    	document.getElementById('send_SMS').disabled= '';
    }
    
    return error;
	  
 }
   
   
/*Methodos gia to validation tou message pediou. Tha prepei kapws na deixnei sto xrhsth poious xarakthres
 *  exei eisagei oi opoioi den epitrepontai, kathws k na mhn epistrefei pote true, ean to sms den einai good to go.
 */
function validate_text(field)
{
    with (field)
    {
        var b = true;
        var text = field.value;
        for (var i = 0; i < text.length; i++) {

            b &= isValidChar(text.charAt(i));
        }
        return b;
    }

}

/** This method validates the field passed as a parameter to ensure it only contains digits.
 *  Any brackets , '-' and '.' are removed, as well as leading double 0s.
 * @param field The destination field. Should only consist of digits.
 */
function validate_dest(field) {
    var error = "";
    var stripped = field.value.replace(/[\(\)\.\-\ ]/g, '');
    var noLeadingZeroes = stripped.replace(/^00/, '');

    recipientOK = false;
    document.getElementById('send_SMS').disabled= 'true';
    document.getElementById('scheduleSMS').disabled= 'true';


    if (field.value == "") {
        error = " is empty!\n";
        //field.style.background = 'orange';
        document.getElementById('recipientBadIcon').style.display='inline';
        document.getElementById('recipientOkIcon').style.display='none';
    } else if (noLeadingZeroes.search(/\D/g) > -1) {
        error = " contains illegal characters.\n";
        //field.style.background = 'orange';
        document.getElementById('recipientBadIcon').style.display='inline';
        document.getElementById('recipientOkIcon').style.display='none';
    } else if (field.value.length > 16) {
        error = " too long.\n";
        //field.style.background = 'orange';
        document.getElementById('recipientBadIcon').style.display='inline';
        document.getElementById('recipientOkIcon').style.display='none';
    } else if (field.value.length <10) {
            error = " too short.\n";
            //field.style.background = 'orange';
            document.getElementById('recipientBadIcon').style.display='inline';
            document.getElementById('recipientOkIcon').style.display='none';
    }  else {
        //field.style.background = 'White';
        document.getElementById('recipientBadIcon').style.display='none';
        document.getElementById('recipientOkIcon').style.display='inline';
        recipientOK = true;
        if(textOK && originatorOK && recipientOK){
            document.getElementById('send_SMS').disabled= '';
            document.getElementById('scheduleSMS').disabled= '';
        }


    }

    field.value = noLeadingZeroes;

    return error;
}


function validate_group_dest(field) {
    var error = "";

    recipientOK = false;
    document.getElementById('send_SMS').disabled= 'true';
    document.getElementById('scheduleSMS').disabled= 'true';

    var opts = field.options;
    var hasSelected = false;
    for(var i=0;i<opts.length;i++){
        hasSelected |= opts[i].selected;
    }

    if(!hasSelected) {
        error = " no group selected!\n";
        //field.style.background = 'orange';
        document.getElementById('recipientBadIcon').style.display='inline';
        document.getElementById('recipientOkIcon').style.display='none';
    }  else {
        //field.style.background = 'White';
        document.getElementById('recipientBadIcon').style.display='none';
        document.getElementById('recipientOkIcon').style.display='inline';
        recipientOK = true;
        if(textOK && originatorOK && recipientOK){
            document.getElementById('send_SMS').disabled= '';
            document.getElementById('scheduleSMS').disabled= '';
        }

    }

    return error;
}



/** Validates the originator field passed as a parameter. This can contain an alphanumeric value of up to 11 characters,
 * with only  latin characters, or up to 16 digits.
 *
 * @param field The originator field.
 */
function validate_originator(field) {
    var error = "";

    field.value = field.value.replace(/[\'\`]/g, '');

    if (field.value == "") {
        error = " is empty!\n";
        document.getElementById('originatorBadIcon').style.display='inline';
        document.getElementById('originatorOkIcon').style.display='none';
    } else if (!field.value.match(/^([+]?[0-9]{10,16}|[0-9a-zA-Z!:;+.-]{0,11})$/)) {
            error=" invalid characters. \n";
            document.getElementById('originatorBadIcon').style.display='inline';
            document.getElementById('originatorOkIcon').style.display='none';
    } else if (field.value.search(/\D/g) == -1) {   //only contains digits, so allow up to 16 chars.
        if (field.value.length > 16 || field.value.length <10 ){             //if exceeded length
            error=" digit-only originator too long. \n";
            document.getElementById('originatorBadIcon').style.display='inline';
            document.getElementById('originatorOkIcon').style.display='none';
        }else{
            error="";
            document.getElementById('originatorBadIcon').style.display='none';
            document.getElementById('originatorOkIcon').style.display='inline';
        }

    /*} else if (field.value.length > 11) {
        error=" alphanumeric originator too long. \n";
        document.getElementById('originatorBadIcon').style.display='inline';
        document.getElementById('originatorOkIcon').style.display='none';
        */
    } else {
        error="";
        document.getElementById('originatorBadIcon').style.display='none';
        document.getElementById('originatorOkIcon').style.display='inline';
    }

    if(error!=""){
        originatorOK = false;
        document.getElementById('send_SMS').disabled = 'true';
        if(document.getElementById('scheduleSMS')!=null)
        	document.getElementById('scheduleSMS').disabled = 'true';
    }else{
        originatorOK = true;
        if(textOK && originatorOK && recipientOK){
            document.getElementById('send_SMS').disabled= '';
            if(document.getElementById('scheduleSMS')!=null)
            	document.getElementById('scheduleSMS').disabled= '';
        }

    }

    return error;
}


function validate_file_dest(field) {
    var error = "";
    recipientOK = false;
   	document.getElementById('send_SMS').disabled= 'true';
    

    if(field.value!="" && field.value!="-1"){ 
     	recipientOK = true;
     	if(document.getElementById('recipientBadIcon')!=null){
     		document.getElementById('recipientBadIcon').style.display='none';
     		document.getElementById('recipientOkIcon').style.display='inline';
        }
    }
    else{
    	error = "no selected file";
    	if(document.getElementById('recipientBadIcon')!=null){
    		document.getElementById('recipientBadIcon').style.display='inline';
    		document.getElementById('recipientOkIcon').style.display='none';
    	}
    }
    
    if(	originatorOK && recipientOK){
    	if(document.getElementById('send_SMS')!=null)
    		document.getElementById('send_SMS').disabled= '';
    	if(document.getElementById('scheduleSMS')!=null)
    		document.getElementById('scheduleSMS').disabled= '';
       
    }
    

   return error;
}


function validate_file_contacts_dest(field) {
    var error = "";
    recipientOK = false;
    
   	document.getElementById('send_SMS').disabled= 'true';
   	document.getElementById('scheduleSMS').disabled= 'true';

    var opts = field.options;
    var hasSelected = false;
    var hasContacts = false;
    
    hasSelected = opts[0].selected;
   
    if(hasSelected){
    	if((opts[0].value - opts[1].value)>0) hasContacts = true;
    	else if(opts[0].value>0) hasContacts = true;
    	else hasContacts = false;
    }
    
    
   	if(hasSelected && hasContacts){
   		recipientOK = true;
   		document.getElementById('recipientBadIcon').style.display='none';
   		document.getElementById('recipientOkIcon').style.display='inline';
   		
   		//document.getElementById("dtemplates").disabled= '';
   	}
   	else{
   		error = "no selected file";
  		document.getElementById('recipientBadIcon').style.display='inline';
   		document.getElementById('recipientOkIcon').style.display='none';
   	}
   	
    if(	textOK && originatorOK && recipientOK){
    	document.getElementById('send_SMS').disabled= '';
    	document.getElementById('scheduleSMS').disabled= '';
   }
   return error;
}





function validateSuggestion(element, label_id, hidden_id){
    var text = element.value;
    document.getElementById(label_id).innerHTML = '';
    //var corr_text = UnicodeGreekToGSM(text, label_id,hidden_id,false);
    var corr_text = UnicodeGreekToGSM(text, label_id,hidden_id,false);



    if(corr_text == text){
        //document.getElementById(label_id).className = 'noError';
    }
    document.getElementById(label_id).className = 'noError';
    document.getElementById(label_id).innerHTML = corr_text;
}


function correctInText(error, errorElementId, originalTextElementId, correctionFromId){
    var elmText = document.getElementById(originalTextElementId).innerHTML;
    var userCorrectionText = document.getElementById(correctionFromId).value;
    var errorElm = document.getElementById(errorElementId);

    errorElm.innerHTML = userCorrectionText;
    errorElm.className = 'noError';
    document.getElementById(originalTextElementId).value = elmText;

    areAllErrorsFixed();

}

function correctInTextWithCorrection(error, errorElementId, originalTextElementId, correction){
    var elmText = document.getElementById(originalTextElementId).innerHTML;
    var errorElm = document.getElementById(errorElementId);

    errorElm.innerHTML = correction;
    errorElm.className = 'noError';
    document.getElementById(originalTextElementId).value = elmText;

}



function produceOverlibText(chars, errorElementId, originalElementId){
    var result="";
    var charArray = simple_UnicodeGreekToGSM(chars);
    //validateSuggestion(document.getElementById('suggestionInputBox'),'suggestionLabelBox', 'userCorrection')

    result = (result+ "<div id=\"suggestionDiv\">" +
                                   "<div class=\"label\">Invalid characters for message type: <a href=\"#\">Click here for more info.</a></div>" +
                                   "<br>" +
                                   "<input type=\"text\" class=\"text\" id=\"suggestionInputBox\" onkeyup=\"validateSuggestion(this, 'suggestionLabelBox', 'userCorrection');\" value=\""+chars+"\"/>" +
                                   "<br><br>" +
                                   "<span class=\"label\">Suggested correction:</span>" +
                                   "<br>" +
                                   "<input type=\"hidden\" id=\"userCorrection\" value=\""+charArray+"\" />" +
                                   "<div id=\"suggestionLabelBox\">" +
                                   "<span class=\"noError\">"+charArray+"</span>" +
                                   "</div>" +
                                   "<br>" +
                                   "<input type=\"button\" value=\"OK\" onclick=\"correctInText('"+chars+"', '"+errorElementId+"', '"+originalElementId+"', 'userCorrection'); return cClick();\" />"+
                                   "<input type=\"button\" value=\"Cancel\" onclick=\"return cClick();\" />"+
                                   "</div>");
    /*
     result = String.concat(result,"<table class=\"suggestionTable\"><tbody>");

     //for(var i=0;i<charArray.length;i++){
     result = String.concat(result, "<tr id=\"row\" class='nonHighlightedSelection' onclick=\"correctInText('"+chars+"', '"+errorElementId+"', '"+originalElementId+"', '"+charArray+"');\" onmouseover=\"document.getElementById('row').className='highlightedSelection';\" onmouseout=\"document.getElementById('row').className='nonHighlightedSelection';\" ><td><label id=\"suggestion\" >"+charArray+"</label></td></tr>");
     //}

     result = String.concat(result, "</tbody></table>");
     */

    return result;
}

/**
 *  Checks the SMS counter embedded in the page to see if the limit for this SMS type has been exceeded and,
 *  if so, if concatenation has also not been selected. If so, the message will be sent out as 2 separate SMS messages,
 * which is seldom what our users want. Display alert, which they will then have to confirm, in order to proceed!
 *
 * @param sms_count_elem_id The id of the element where the SMS count is stored.
 * @param concat_elem_id The id of the element where the user can select the 'concatenation' option.
 *
 * @return true if authorized by the user to proceed, false otherwise.
 * /
function avoid2SMS(sms_count_elem_id, concat_elem_id){
    var sms_count = document.getElementById(sms_count_elem_id).innerHTML;

    if(sms_count > 1 && (!document.getElementById(concat_elem_id).checked)){
        return confirm("<?=$hlang[112]?>" + sms_count + "<?=$hlang[113]?>");
    }

    return true;
}
*/
var myExitBlue = new Image();
myExitBlue.src = "i/exit_blue.gif";

var myExitMetallic = new Image();
myExitMetallic.src = "i/exit_metallic.gif";

function showSuggestionsBox(elem){
    with (elem){
        if(className == 'errorInText'){
            var errorImg ="<img src='i/warning.png' alt='Close' width='16' height='16' border='0'>&nbsp;" ;
            var closeimgMetallic =
                    "<img src='i/exit_metallic.gif' alt='Close' width='14' height='15' border='0' name='metallicExit' id='metallicExit' "
                            +"onmouseover='document.metallicExit.src=myExitBlue.src' "
                            +"onmouseout='document.metallicExit.src=myExitMetallic.src'>";

            return overlib(produceOverlibText(innerHTML, id, "illegal_text"), STICKY, WIDTH, 50, WRAP, TEXTSIZE, 4, CLOSECLICK, FGCOLOR, '#d9e0ba', CAPTION, errorImg + 'Error!', CLOSETEXT, closeimgMetallic, CAPTIONFONTCLASS, 'olcapError', BGCOLOR, '#d9e0ba',CGCLASS,'olraisedError', CLOSETITLE,'Close', CAPTIONFONTCLASS,'olcapError', FGCLASS,'olfgError',  BORDER, "1");
        }else{
            return nd();
        }
    }

}

/**
 * Ensures the maximum limit is not exceeded for the selected message type.
 */
function checkMaxLimit(){
    var maxFlashSMS = 160;
    var maxUCS2SMS = 300;
    var maxGSMSMS = 300;

    var type = getSmsType();

    if(type=='t'){

    }else if(type == 'f'){

    }else if(type == 'u'){

    }


}


function changeCursor(elem){
    elem.style.cursor="pointer";
}

//credit to Jesse Skinner for this!!
var guid = (function() {
    // same guid counter, but we keep it hidden inside here
    var guid_counter = 0;

    // return a function that has access to guid_counter
    return function() {
        // whenever guid() is called, return and increment the counter
        return guid_counter++;
    };

})(); // note the () - this executes the outer function right now!



var textOK = false;
var originatorOK = false;
var recipientOK = false;

var sStart;
var sEnd;

function getCaretPosition(textArea)
{
    var start = 0;
    var end = 0;
    // a bit weird but we need the range object to set the caret in setCaretPosition() for IE
    var rangeCopy = null;

    if(document.getSelection) // FF
    {
        start = textArea.selectionStart;
        end = textArea.selectionEnd;
    }
    else if(document.selection) // IE
    {
        // The current selection
        var range = document.selection.createRange();
        rangeCopy = range.duplicate();
        // Select all text
        rangeCopy.moveToElementText(textArea);
        // Now move 'dummy' end point to end point of original range
        rangeCopy.setEndPoint( 'EndToEnd', range );
        // Now we can calculate start and end points
        start = rangeCopy.text.length - range.text.length;
        end = start + range.text.length;
    }
    sStart = start;
    sEnd = end;
    return {start: start, end: end, rangeCopy: rangeCopy};
}

function setCaretPosition(ctrl, posStart, posEnd)
{

    if(ctrl.setSelectionRange)
    {
        ctrl.focus();
        ctrl.setSelectionRange(posStart,posEnd);
    }
    else if (ctrl.createTextRange) {
        var range = ctrl.createTextRange();
        range.collapse(true);
        range.moveEnd('character', posEnd);
        range.moveStart('character', posStart);
        range.select();
    }
}

function inputKey(input) {
    sStart = getCaretPosition(input).start;
    sEnd = getCaretPosition(input).end;
}

function doSelect() {
    var input = document.getElementById("message");
    input.focus();
    setCaretPosition(input, sStart,sEnd);
}

function doTemplateSelect() {
    var input = document.getElementById("messageEDIT");
    input.focus();
    setCaretPosition(input, sStart,sEnd);
}



function enableDisableButton(select,button){

	var but = $("#" + button );
	var sel = $("#" + select + " option:selected").val();

	but.attr("disabled","true");

	if( sel && sel > 0 ){
		but.attr("disabled","");	
	}
}


/**
 * These functions work with the TinyMce text area.
 */

function validateAll_Tiny(sms_txt, dosuggestion,mode,lang) {
	
		var text = getMessageAsPlainText_Tiny(sms_txt);
    	
	    if(dosuggestion){
	        textOK = true;
	        if(textOK && originatorOK && recipientOK){
	        	
	            if(document.getElementById('send_SMS')!=null){
	            	document.getElementById('send_SMS').disabled = '';
	           	}
	            if(document.getElementById('scheduleSMS')!=null){
	            	document.getElementById('scheduleSMS').disabled = '';
	            }
	        }
	        document.getElementById('originalMessageDiv').style.display = 'inline';

	        //suggest GSM text, if applicable
	        var sms_type = document.getElementById('type').value;//getSmsType();
	        
	        if (sms_type == 't'|| sms_type == 'f'){
	        	if(sms_txt!=null) sms_txt = simple_UnicodeGreekToGSM(sms_txt);
	        }

	        if(text==null || text == ''){
	            textOK = false;
	            
	            if(document.getElementById('send_SMS')!=null){
	            	document.getElementById('send_SMS').disabled = 'true';
	           	}
	            if(document.getElementById('scheduleSMS')!=null){
	            	document.getElementById('scheduleSMS').disabled = 'true';
	            }
	       
	        }else{
	        	
	        	if(mode=="single"){
		        	var myBookmark = tinyMCE.activeEditor.selection.getBookmark();
		        	tinyMCE.activeEditor.setContent(sms_txt);
		        	tinyMCE.activeEditor.selection.moveToBookmark(myBookmark);
		    	}
	        	else if(mode=="multiple"){
	        		tinyMCE.activeEditor.execCommand('mceInsertContent', false, sms_txt);
	        	}
	        }
	    }
	   
	    countSMS_Tiny(text,lang);
	};

	/** Metraei posa SMS tha xreiastoun apo ton epilegmeno tipo minimatos, gia na pragmatopoiithei i apostolh tou SMS.
	 *   Epishs kanei update to antistoixo label, kai epistrefei ton arithmo afton gia ta SMS. O arithmos einai panta akeraios.
	 *
	 * @param txt To keimeno pou exei eisagei o xrhsths gia to sms.
	 */
	function countSMS_Tiny(txt,lang) {

	    var type = document.getElementById('type').value;

	    var concatenation = "";
	    
	    if(document.getElementById('opt_concat').value==='t')
	    	concatenation = true;
	    else
	    	concatenation = false;

	    var chars = -1;
	    var sms = -1;
	    var maxChars = 0;

	   
	    chars = countChars_Tiny(txt);
	   
	    if (type == 't' || type == 'f') {

	        if (chars <= 160) {        //for 1 SMS
	            sms = 1;
	        } else {                           //for more than 1 SMS
	            if(concatenation){
	                var remainder = chars % 153;
	                if (remainder == 0)
	                    sms = chars / 153;
	                else
	                    sms = ( (chars - remainder) / 153 ) + 1;
	            }else{
	                var remainder = chars % 160;
	                if (remainder == 0)
	                    sms = chars / 160;
	                else
	                    sms = ( (chars - remainder) / 160 ) + 1;
	            }
	        }

	    } else if (type == 'u') {
	        if (chars <= 70) {        //for 1 SMS
	            sms = 1;
	        } else {                           //for more than 1 SMS
	            if(concatenation){
	                remainder = chars % 67;
	                if (remainder == 0)
	                    sms = chars / 67;
	                else
	                    sms = ( (chars - remainder) / 67 ) + 1;
	            }else{
	                remainder = chars % 70;
	                if (remainder == 0)
	                    sms = chars / 70;
	                else
	                    sms = ( (chars - remainder) / 70 ) + 1;
	            }
	        }
	    }

	    if(chars===0){ 	words=0; sms = 0; }
	    else{ words =  txt.split(' ').length;}
	   
	    if(type == 't' || type == 'u'){	maxChars = 300; }
	    else if(type == 'f'){ maxChars = 160;}
	    
	    if(chars<=maxChars){
		    //Count chars, words, remaining chars 
			var status_text = "";
			
			if(lang=='en')
				status_text = words + " words, <span id=\"chars\">" + chars + "</span> characters, <span id=\"smses\" style=\"font-weight:900\">"+ sms +"</span> <span style=\"font-weight:900\">sms</span>, " +(maxChars-chars) + " remaining";
			else if(lang=='el')
				status_text = words + " λέξεις, <span id=\"chars\">" + chars + "</span> χαρακτήρες, <span id=\"smses\" style=\"font-weight:900\">"+ sms +"</span> <span style=\"font-weight:900\">μηνύματα</span>, " +(maxChars-chars) + " μένουν";
			
			tinymce.DOM.setHTML(tinymce.DOM.get(tinyMCE.activeEditor.id + '_path_row'), status_text);
	    }
	    else if(chars > maxChars){
			txt = txt.substring(0,maxChars);
			tinyMCE.execCommand('mceSetContent',false,txt);
			
			tinyMCE.execInstanceCommand("message","selectall", false, null);
	        sel = tinyMCE.activeEditor.selection.getSel();
	        sel.collapseToEnd();
		}
	}
	
		
	/** Metraei swsta ton arithmo twn xarakthrwn pou xreiazontai gia na figei ena GSM minima. Lamvanei ip'opsi
	 *   ta { } [ ] ^ ~ | \ € kai ta metraei swsta gia diplous xarakthres. Gia UCS-2 minimata, i gia minimata pou den periexoun
	 *   aftous tous xarakthres, apla epistrefetai to mhkos tou txt, opws afto dinetai apo thn length.
	 *
	 * @param txt To keimeno tou opoiou i katametrhsh GSM xarakthrwn prepei na ginei..
	 */
	function countChars_Tiny(txt) {

	    var result = 0;
	    var sms_type = document.getElementById('type').value;//getSmsType();


	    if (sms_type == 't' || sms_type == 'f') {

	        for (var i = 0; i < txt.length; i++) {

	            var code = txt.charCodeAt(i);
	            
	            if (code == 12) {                                                     //FORM FEED
	                result += 2;
	            } else if (code == 94) {                                            //CIRCUMFLEX ACCENT
	                result += 2;
	           // }
	           // else if (code == 10) {                                            //ENTER
	           //     result += 2;
	            } else if (code == 123) {                                          //LEFT CURLY BRACKET
	                result += 2;
	            } else if (code == 125) {                                          //RIGHT CURLY BRACKET
	                result += 2;
	            } else if (code == 92) {                                           //REVERSE SOLIDUS
	                result += 2;
	            } else if (code == 91) {                                           //LEFT SQUARE BRACKET
	                result += 2;
	            } else if (code == 126) {                                          //TILDE
	                result += 2;
	            } else if (code == 93) {                                           //RIGHT SQUARE BRACKET
	                result += 2;
	            } else if (code == 124) {                                         //VERTICAL LINE
	                result += 2;
	            } else if (code == 8364) {                                       //EURO SIGN
	                result += 2;
	            } else if (code == 13){
	              continue;
	            }
	            else {
	                result++;
	            }
	            lastCharCode=code;
	        }

	        return result;
	        
	    } else {
	        return txt.length;
	    }
	}
	
	function getMessageAsPlainText_Tiny(txt){
		
/*		var myBookmark = tinyMCE.activeEditor.selection.getBookmark();
		tinyMCE.execInstanceCommand(tinyMCE.activeEditor.id,"selectall", false, null);
		text = tinyMCE.activeEditor.selection.getContent({format : 'text'});
		
		tinyMCE.activeEditor.selection.moveToBookmark(myBookmark);
		
		return text;
*/		
		
		if(txt!=null && txt!=true){
			txt = txt.replace(/(<br>)/ig,"\n");
			txt = txt.replace(/(\n)$/ig,"");
			txt = txt.replace(/(<([^>]+)>)/ig,"");
			txt = txt.replace(/&nbsp;/ig," ");
			txt = txt.replace(/&lt;/ig,"<");
			txt = txt.replace(/&gt;/ig,">");
			
			return txt;
		}else{
			return "";
		}
	}
	
	
	function moveCursorToLineStart(inst) {
	    
		inst.selection.select(inst.selection.getEnd());
	    
	    if (tinyMCE.isMSIE) {
	        rng = inst.getRng();
	        rng.collapse(false);
	        rng.select();
	    }
	    else {
	        sel = inst.selection.getSel();
	        sel.collapseToStart();
	    }
	}
	

/** i18n  */
/*
 if ($_SESSION['l'] == 'el'){
 //greek
 $submenu = array(
 "Απλό SMS"
 ,	"Αλλαγή Password"
 ,	"Μαζικά SMS"
 ,	"Επαφές"
 ,	"Ομάδες επαφών"
 ,	"Κωδ. εξαργύρωσης"	#5
 ,	"Επιλογές"	#6
 );
 $hlang = array(
 "Απλό SMS" #0
 ,	"Μήνυμα" #1
 ,	"χαρακτήρες" #2
 //,	"Κινητό" #3
 ,	"Προς" #3
 ,	"Αποστολέας" #4
 ,	"Flash SMS" #5
 ,	"Αποστολή SMS" #6
 ,	"Το SMS στάλθηκε" #7
 ,	"Το SMS δεν στάλθηκε" #8
 ,	"Ο αριθμός κινητού τηλεφώνου δεν είναι σωστός" #9
 ,	"Δεν γράψατε το κινητό του παραλήπτη"	#10
 ,	"Δεν γράψατε το κείμενο του SMS"	#11
 ,	"Πρέπει πρώτα να κάνετε Sign In" #12
 ,	"Γράψτε 2 φορές το νέο password που επιθυμείτε:" #13
 ,	"Νέο password"	#14
 ,	"Επιβεβαίωση password"	#15
 ,	"Αλλαγή password"	#16
 ,	"Το password σας έχει αλλάξει"#17
 ,	"Αλλαγή password" #18
 ,	"Δεν γράψατε το νέο password" #19
 ,	"Δεν επιβεβαιώσατε το νέο password" #20
 ,	"Τα passwords δεν είναι όμοια, επιβεβαιώστε το νέο password" #21
 ,	"Ξεχάσατε το password;"	#22
 ,	"Γράψτε τον αριθμό του κινητού και ένα νέο password θα σας σταλεί στο email σας" #23
 , "αποστολή νέου password" #24
 ,	"Κάντε κλίκ"	#25
 ,	"εδώ"	#26
 ,	"Το Password άλλαξε"	#27
 ,	"Το νέο password σας έχει σταλεί με email"	#28
 , "Ελέγξτε τον αριθμό του κινητού"	#29
 ,	"Ο λογαριασμός δεν είναι ενεργός, το password δεν άλλαξε."	#30
 ,	"Αν δεν λάβατε το password στο κινητό σας με SMS "	#31
 ,	"επικοινωνήστε μαζί μας"	#32
 ,	"Πρόβλημα με το password SMS"	#33
 ,	"Γεία σας, ο αριθμός του κινητού μου είναι "	#34
 ,	"ProSMS.gr Messenger"	#35
 ,	"Κατεβάστε το <a class=aDownload href=?v=".VIEW_DOWNLOAD.">ProSMS.gr Messenger</a> για Windows και στείλτε SMS από τον υπολογιστή σας!"	#36
 ,	"Ειδικά χαρακτηριστικά:"	#37
 ,	"Αποστολή SMS σε έναν ή περισσότερους παραλήπτες"	#38
 ,	"" #39 nu
 ,	"Εισαγωγή λίστας επαφών και ομαδοποίηση επαφών" #40
 ,	"Προσωπικές ρυθμίσεις"	#41
 ,	"Πλήρες Ιστορικό όλων των αποστολών"	#42
 ,	""	#43 nu
 ,	"Αναφορές παράδοσης"#44
 ,	"Δείτε screenshots" #45
 ,	"Προγραμματισμένες αποστολές SMS" #46
 ,	"Επαναλαμβανόμενα SMS"	#47
 ,	"Αναφορά παράδοσης"	#48
 ,	"Προς"	#49
 ,	"Αποστολή SMS"	#50
 ,	"Επαφές & ομάδες"	#51
 ,	"Επιλογές"	#52
 ,	"Δεν έχετε δημιουργήσει καμία ομάδα επαφών"	#53
 ,	"Δημιουργία νέας ομάδας επαφών"	#54
 ,	"επαφές"	#55
 ,	"επαφή"	#56
 ,	"Αποστολή μαζικού SMS"	#57
 ,	"Ιστορικό αποστολών"	#58
 ,	"Το <a class=aDownload onclick=\"document.ssmshistory.submit();\" href=\"javascript:{document.ssmshistory.submit();}\">ιστορικό των αποστολών</a> σας για τις τελευταίες " . ($_SESSION['pro']=='t'?HISTORY_DAYS_PRO:HISTORY_DAYS) . " ημέρες"	#59
 ,	"Για τις αποστολές από το web δίνεται πάντα αναφορά παράδοσης"	#60
 ,	"Κατάλογος επαφών"	#61
 ,	"Επιλέξτε μια ή περισσότερες ομάδες επαφών"	#62
 ,	"Αρχικοποίηση"	#63
 ,	"Θέλετε να προσθέσετε τον αριθμό "	#64
 ,	" στη λίστα των επαφών σας;"	#65
 ,	"Όνομα"	#66
 ,	"Προσθήκη επαφής"	#67
 ,	"Δεν έχετε υπόλοιπο SMS στο λογαριασμό σας, το SMS δεν στάλθηκε"	#68
 ,	"SMS"	#69
 ,	"ProSMS.gr Messenger &nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;290 kb"#70
 ,	"Προγραμματισμένα"	#71
 ,	"Απλό SMS"	#72
 ,	"Μαζικά SMS"	#73
 ,	"Προγραμματισμός"	#74
 ,	"Προγραμματισμός της αποστολής"	#75
 ,	"Ειδικές επιλογές"	#76
 ,	"160 χαρακτήρες/SMS (ή 153 χαρακτήρες/SMS, για SMS μεγαλύτερα των 160 χαρακτήρων)"	#77
 ,	"160 χαρακτήρες/SMS"	#78
 , "κείμενο" #79
 , "GSM" #80
 , "Flash" #81
 , "UCS-2" #82
 , "Ping" #83
 , "vCard" #84
 , "vCal" #85
 , "WAP Bookmark" #86
 , "WAP Push" #87
 , "70 χαρακτήρες/SMS (ή 67 χαρακτήρες/SMS, για SMS μεγαλήτερα των 70 χαρακτήρων)" #88
 , "Δεν ορίζονται χαρακτήρες" #89
 , "Επαγγελματική κάρτα (επαφές)" #90
 , "Καταχώριση ημερολογίου (ξυπνητήρι, υπενθυμίσεις, συνεδριάσεις κ.λπ...)" #91
 , "Στείλτε video/picture/mp3 κ.λπ..." #92
 , "Στείλτε video/picture/mp3 κ.λπ..." #93
 , "αλληλουχία" #94
 , "Κείμενο"       #95
 , "Τύπος Κειμένου" # 96
 , "GSM"  # 97
 , "Flash"          # 98
 , "UCS-2"# 99
 , "Η αποστολή να γίνει:" # 100
 , "άμεσα" # 101
 , "αργότερα, σε προγραμματισμένη ώρα" # 102
 , "Επιλέξτε πότε θέλετε να γίνει η (πρώτη) αποστολή" # 103
 , "Επιθυμείτε επανάληψη της αποστολής;" # 104
 , "ναι" # 105
 , "όχι" # 106
 , "Εκτέλεση αποστολής" # 107
 ,"Προτεινόμενο Κείμενο SMS" # 108
 , "Οι μαρκαρισμένοι χαρακτήρες δεν είναι επιτρεπτοί για τον τύπο μηνύματος που επιλέξατε:" #109
 ,"Αποδοχή" #110
 ,"Απόρριψη" #111
 ,"Προσοχή: Το μήνυμά σας θα σταλθεί ως " #112
 , " ΞΕΧΩΡΙΣΤΑ μηνύματα. Είστε βέβαιοι ότι θέλετε να συνεχίσετε; " #113
 , "Για να αλλάξετε τον αποστολέα, πατήστε στο Ιστορικό / Επιλογές και πατήστε στο \'Επιλογές\' στα αριστερά. Κατόπιν τροποποιήστε το πεδίο \'Αποστολέας\'  στις Προεπιλογές." #114
 , "<b>Συ:</b> To correct <b>individual</b> mistakes try clicking on <b>highlighted</b> letters." #115
 , "Akirwsi allagwn" #116
 , "Προεπισκόπηση Αλλαγών που θα γίνουν στο κείμενό σας.." # 117
 , "Πατήστε για να μεταφέρετε τις αλλαγές στο αρχικό σας κείμενο.." # 118
 , "Άκυρο" #119
 , "Διόρθωση Όλων" #120
 , "Πατήστε για διόρθωση" #121
 , "Το πεδίο επιτρέπεται να περιέχει μόνο ψηφία." #122
 , "Για να αλλάξετε τον αποστολέα, πατήστε στο Ιστορικό / Επιλογές και πατήστε στο \'Επιλογές\' στα αριστερά. Κατόπιν τροποποιήστε το πεδίο \'Αποστολέας\'  στις Προεπιλογές." #114
 , "Αυτοί οι χαρακτήρες δεν είναι επιτρεπτοί για τον τύπο μηνύματος που έχετε επιλέξει! : " #124
 , "Πατήστε εδώ για περισσότερες πληροφορίες." #125
 , "Προτεινόμενη διόρθωση:"  #126
 , "Δείτε τη λίστα με τις επαφές σας, από όπου μπορείτε να επιλέξετε τον αριθμό του παραλήπτη." # 127
 , "Πατήστε εδώ για να εμφανιστεί από κάτω η λίστα με τις προχωρημένες επιλογές." #128
 , "Το πεδίο του αποστολέα δεν είναι στη σωστή μορφή." #129
 , "Το πεδίο του παραλήπτη δεν είναι στη σωστή μορφή. #130
 , "Κάποιοι από τους χαρακτήρες που εισάγατε δεν επιτρέπονται σε μηνύματα GSM. Εάν επιθυμείτε να τους εισάγετε στο μήνυμά σας, παρακαλώ επιλέξτε έναν άλλο τύπο μηνύματος από τις Ειδικές Επιλογές." #131
 , "Κάποιοι από τους χαρακτήρες που εισάγατε έχουν μετατραπεί στους αντίστοιχους επιτρεπτούς χαρακτήρες GSM. Εάν δεν επιθυμείτε αυτές τις διορθώσεις, παρακαλώ επιλέξτε έναν άλλο τύπο μηνύματος από τις Ειδικές Επιλογές." #132
 , "Το κείμενο σας είναι κατάλληλο για αποστολή." #133
 , "Το πεδίο του Αποστολέα. Μπορείτε να εισάγετε μέχρι 11 λατινικούς χαρακτήρες (σε συνδυασμό με νούμερα), ή μέχρι 16 ψηφία."  #134
 , "" #135
 , "" #136
 , "" #137
 , "" #138
 , "" #139
 , "" #140
 , "" #141
 , "" #142
 , "" #143
 , "" #144
 , "" #145
 , "" #146
 , "" #147
 , "" #148
 , "" #149

 );

 }else{
 //english
 $submenu = array(
 "Single SMS"	#0
 , "Change Password"	#1
 ,	"Group SMS"	#2
 ,	"Contacts"	#3
 ,	"Groups"		#4
 ,	"Redeem Code"	#5
 ,	"Options"	#6
 );

 $hlang = array(
 "Single SMS" #0
 ,	"SMS" #1
 ,	"characters" #2
 //,	"Mobile" #3
 ,	"To" #3
 ,	"Originator" #4
 ,	"Flash SMS" #5
 ,	"Send SMS" #6
 ,	"SMS has been sent" #7
 ,	"SMS could not be send" #8
 ,	"The mobile number is not correct" #9
 ,	"You must enter the target mobile number of the SMS"	#10
 ,	"You must enter the body of the SMS"	#11
 ,	"You must first Sign In" #12
 ,	"Please enter the new password and confirm it:" #13
 ,	"New password"	#14
 ,	"Confirm password"	#15
 ,	"Change password"	#16
 ,	"Your password has been changed"#17
 ,	"Change password" #18
 ,	"Please enter the new password" #19
 ,	"Please confirm the new password" #20
 ,	"Passwords do not match, please confirm the new password" #21
 ,	"Forgot your password?"	#22
 ,	"Enter your mobile number and a new password will be send to your email address" #23
 ,	"send new password" #24
 , "Click"	#25
 ,	"here"	#26
 ,	"Password changed"	#27
 ,	"The new password has been emailed to you"	#28
 ,	"Check the mobile number"	#29
 ,	"Account is not active, cannot change password"	#30
 ,	"If you did not receive your password by SMS please" 	#31
 ,	"contact us"	#32
 ,	"Problem with password SMS"	#33
 ,	"My mobile is "	#34
 ,	"ProSMS.gr Messenger"	#35
 ,	"Download the <a  class=aDownload href=?v=".VIEW_DOWNLOAD.">ProSMS.gr Messenger</a> and send SMS right from your desktop!"	#36
 ,	"Special Features:"	#37
 ,	"Send single or mass SMS"	#38
 ,	"" #39 nu
 ,	"Contact list and group of contacts" #40
 ,	"Personalize"	#41
 ,	"Full history of SMS sent"	#42
 ,	""	#43 nu
 ,	"Delivery Reports"	#44
 ,	"View screenshots" #45
 ,	"Differed SMS" #46
 ,	"Reccurrent sends"	#47
 ,	"Delivery report"	#48
 ,	"To"	#49
 ,	"Send SMS"	#50
 ,	"Contacts & Groups"	#51
 ,	"Options"	#52
 ,	"You have defined no groups of contacts"	#53
 ,	"Create new group of contacts"	#54
 ,	"contacts"	#55
 ,	"contact"	#56
 ,	"Send group SMS"	#57
 ,	"Sent history"	#58
 ,	"The <a class=aDownload onclick=\"document.ssmshistory.submit();\" href=\"javascript:{document.ssmshistory.submit();}\">sent history</a> for the last " . ($_SESSION['pro']=='t'?HISTORY_DAYS_PRO:HISTORY_DAYS) . " days"	#59
 ,	"Delivery report is automatically provided from the web site"	#60
 ,	"Contact list"	#61
 ,	"Select at least one group of contacts"	#62
 ,	"Reset"	#63
 ,	"Do you want to add" #64
 ,	"into your personal contacts?"	#65
 ,	"Name"	#66
 ,	"Insert contact"	#67
 ,	"You have not enough SMS, SMS not sent"	#68
 ,	"SMS"	#69
 ,	"ProSMS.gr Messenger v.&nbsp;&nbsp;290 kb" #70
 ,	"Scheduled SMS"	#71
 ,	"Single SMS"	#72
 ,	"Group SMS"	#73
 ,	"Schedule send"	#74
 ,	"Schedule this SMS send"	#75
 ,	"Advanced options"	#76
 ,	"160 characters/SMS (or 153 characters/SMS, for more that 160 characters long SMS)"	#77
 ,	"160 characters/SMS"	#78
 , "text" #79
 , "GSM" #80
 , "Flash" #81
 , "UCS-2" #82
 , "Ping" #83
 , "vCard" #84
 , "vCal" #85
 , "WAP Bookmark" #86
 , "WAP Push" #87
 , "70 characters/SMS (or 67 characters/SMS, for more that 70 characters long SMS)" #88
 , "No user-defined characters" #89
 , "Business card (contacts)" #90
 , "Calendar entry (alarms, reminders, meetings etc)" #91
 , "Send video/picture/mp3 etc" #92
 , "Send video/picture/mp3 etc" #93
 , "concatenate" #94
 , "SMS Text"       #95
 , "Text Type" # 96
 , "GSM"  # 97
 , "Flash"          # 98
 , "UCS-2"# 99
 , "Do you wish to send the message ..:" # 100
 , "now" # 101
 , "later, at a scheduled time.." # 102
 , "Please select when you wish the (first) dispatch to take place" # 103
 , "Do you wish to repeat the dispatch of this SMS regularly?" # 104
 , "yes" # 105
 , "no" # 106
 , "Send" # 107
 , "Suggested SMS Text" # 108
 , "The highlighted characters are invalid for the message type you have selected" #109
 ,"Accept" #110
 ,"Ignore" #111
 ,"Warning: Your message will be sent as " #112
 , " SEPARATE messages! Are you sure you wish to proceed?" #113
 , "To change the originator, go to History / Options, and click Options on the left. Then modify the \'Originator\' field in the Defaults section." #114
 , "<b>Tip:</b> To correct <b>individual</b> mistakes try clicking on <b>highlighted</b> letters." #115
 , "Undo Changes" #116
 , "Preview Automatic Corrections made to your text.." # 117
 , "Click to tranfer corrections to your original text.." # 118
 , "Cancel" #119
 , "Fix All" #120
 , "Click to fix" #121
 , "The destination is only allowed to contain digits." #122
 , "To change the originator, go to History / Options, and click Options on the left. Then modify the \'Originator\' field in the Defaults section" #123
 , "These characters are invalid for the message type you have selected! : " #124
 , "Click here for more info." #125
 , "Suggested correction:"  #126
 , "Bring up the list of your contacts, in order to select the recipient." #127
 , "Click to display the list of advanced options below." #128
 , "The originator field is not in the correct format." #129
 , "The to field is not in the correct format." #130
 , "Some of the characters you inserted are not allowed in GSM messages. If, nevertheless, you wish to insert them in your message, please select an alternate message type under Advanced Options.  " #131
 , "Some of the characters you inserted have been modified to the appropriate characters allowed in the GSM character set. If you do not wish this correction to take place, then please select an alternate message type under Advanced Options." #132
 , "Your text is ok." #133
 , "The originator field. Up to 11 alphanumeric characters allowed (latin), or up to 16 digits." #134
 , "" #135
 , "" #136
 , "" #137
 , "" #138
 , "" #139
 , "" #140
 , "" #141
 , "" #142
 , "" #143
 , "" #144
 , "" #145
 , "" #146
 , "" #147
 , "" #148
 , "" #149

 * /
 );
 */
