//function vrweb_window(URL,winName,features) { window.open(URL,winName,features); }

        function encode(b){
                if (typeof encodeURIComponent=="function")
                        {return encodeURIComponent(b)}
                else
                        {return escape(b)}
        }
        function add_parameter_to_url(b,a)
        {
                if (a) {window.vrweb_url+="&"+b+"="+a}
        }
        function add_parameter(b,a)
        {
                if (a) {add_parameter_to_url(b,encode(a))}
        }
        function add_parameter_to_url1(b,a)
        {
                if (a) {window.vrweb_url+=b+"="+a}
        }
        function add_parameter1(b,a)
        {
                if (a) {add_parameter_to_url1(b,encode(a))}
        }
        function icon()
        {
                var icon = window.vrweb_icon;
                var iconcolor = window.vrweb_iconcolor;
                var guilang = window.vrweb_guilang;
                var buttonvar = button_version();
                var alttext = alt_text();
                var hostprotocol = (("https:" == document.location.protocol) ? "https://" : "http://");
                if (hostprotocol == 'http://') {
                    return '<img class="vrweb_img" alt="'+alttext+'" border="0" src="'+hostprotocol+'vrweb.linguatec.net/images/vrweb/buttons/'+buttonvar+'/'+iconcolor+'/VRweb_Button_'+icon+'_'+guilang+'.png" />';
                } else {
                    return '<img class="vrweb_img" alt="'+alttext+'" border="0" src="'+hostprotocol+'www.linguatec.net/images/vrweb/buttons/'+buttonvar+'/'+iconcolor+'/VRweb_Button_'+icon+'_'+guilang+'.png" />';
                }
        }
        
        function alt_text()
        {
            var text = 'Vorlesen';
            if (window.vrweb_guilang == 'en') {
                text = 'Read';
            }
            return text;
        }

        function popup_version()
        {
            if (window.vrweb_popup) {
                return window.vrweb_popup;
            } else {
                return 'popup1';
            }
        }
        
        function button_version()
        {
            if (window.vrweb_iconvar) {
                return window.vrweb_iconvar;
            } else {
                return 'normal';
            }
        }
        
        function popup_link()
        {
            if (popup_version() == 'popup3') {
                return 'javascript:window.open(\''+window.vrweb_url+'\',\'vrweb\');return false;'
            } else if (popup_version() == 'popup2') {
                return 'javascript:window.open(\''+window.vrweb_url+'\',\'vrweb\',\'menubar=no,toolbar=no,status=no,location=no,scrollbars=no,resizable=no,width=350,height=250,left=0,top=0\');return false;'
            } else {
                return 'javascript:window.open(\''+window.vrweb_url+'\',\'vrweb\',\'menubar=no,toolbar=no,status=no,location=no,scrollbars=no,resizable=no,width=350,height=120,left=0,top=0\');return false;'
            }
        }
        
        function popup_ptonline(dir,us)
        {
                var txt;
                var form = document.getElementById('pip');
                var browser = form.browser.value
                b = window;
                b.vrweb_url="http://vrweb.linguatec.net/vrweb/popup1_ptonline?";
//                b.vrweb_url="http://vrweb/vrweb/popup1_ptonline?";
                               
                add_parameter1('dir', dir);
                
                if (browser == 'Safari') {
                        if (dir=='1') {
                                txt = form.wDst.value;
                        } else {
                                txt = form.text.value;                       
                        }
                }
                else {
                        if (dir=='1') {
                                txt = tinyMCE.get('wDst').getContent();
                        } else {
                                txt = tinyMCE.get('text').getContent();                       
                        }
                }
                
		txt = txt.replace(/<(.|\r|\n)*?>/ig, "");
		txt = txt.replace(/„/g, '');
		txt = txt.replace(/“/g, '');
		txt = txt.replace(/'/g, "\\'");
		txt = txt.replace(/´/g, "\\'");
		txt = txt.replace(/`/g, "\\'");
		txt = txt.replace(/’/g, "\\'");

                add_parameter('srctext', txt);
                if (us=='1'){
                        add_parameter('lang', 'en-us');
                }
                else {
                        add_parameter('lang', form.langPair.value);
                } 
                add_parameter('guilang', b.vrweb_guilang);
                add_parameter('readcontent',b.vrweb_readcontent);
                add_parameter('srctype',b.vrweb_srctype);
                add_parameter('srccharset',b.vrweb_srccharset);
                add_parameter('readelementsname',b.vrweb_readelementsname);
                add_parameter('readelementsclass',b.vrweb_readelementsclass);
                add_parameter('exclelementsname',b.vrweb_exclelementsname);
                add_parameter('exclelementsclass',b.vrweb_exclelementsclass);
                add_parameter('sitetopic',b.vrweb_sitetopic);
                add_parameter('customerid',b.vrweb_customerid);
                add_parameter('cache',b.vrweb_cache);
                add_parameter('sndpitch',b.vrweb_sndpitch);
                add_parameter('sndspeed',b.vrweb_sndspeed);
                add_parameter('sndtype',b.vrweb_sndtype);
                add_parameter('sndquality',b.vrweb_sndquality);
                add_parameter('sndgender',b.vrweb_sndgender);
                add_parameter('simpleparse',b.vrweb_simpleparse);
 
                window.open(window.vrweb_url,'vrweb','menubar=no,toolbar=no,status=no,location=no,scrollbars=no,resizable=no,width=350,height=120,left=0,top=0');
        }
                        
        function start() {                
                document.write('<a class="vrweb_a" href="#" style="text-decoration:none;" onclick="popup_ptonline(\''+window.vrweb_dir+'\',\'' + window.vrweb_us + '\');">'+icon()+'</a>');
        }
        
        start();

