//Default Links, if not defined

var default_popup_name  =   'PopUp';

//redirect page after time
var timeout_time = 2000;

        
function go_popup(url, popup_url) 
    {
        if (popup_url == '')
            {
                timeout_time = 0;
            }
        
        setTimeout('go_location("'+ url + '")', timeout_time);
        
        if (popup_url != '')
            {
                url = popup_url;
                window.open(url, default_popup_name,'location=yes,toolbar=no,status=no,scrollbars=yes,resizable=yes,top=0,left=10,width=850,height=650');
            }
    }

function go_location(url) 
    {
        //url = URLEncode(url);
        window.location = url;
    }
    
    
function URLEncode(url)
    { 
        var SAFECHARS = "0123456789" + // Numeric 
        "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic 
        "abcdefghijklmnopqrstuvwxyz" + 
        "-_.!~*'()"; // RFC2396 Mark characters 
        var HEX = "0123456789ABCDEF";
     
        var plaintext = url; 
        var encoded = ""; 
        for (var i = 0; i < plaintext.length; i++ ) { 
            var ch = plaintext.charAt(i); 
            if (ch == " ") { 
                encoded += "+"; // x-www-urlencoded, mai degraba, decat %20 
            } else if (SAFECHARS.indexOf(ch) != -1) { 
                encoded += ch; 
            } else { 
                var charCode = ch.charCodeAt(0); 
                if (charCode > 255) { 
                    alert( "Unicode Character '"  + ch 
                    + "' cannot be encoded using standard URL encoding.\n"  
                    + "(URL encoding only supports 8-bit characters.)\n" 
                    + "A space (+) will be substituted." ); 
                    encoded += "+"; 
                } else { 
                    encoded += "%"; 
                    encoded += HEX.charAt((charCode >> 4) & 0xF); 
                    encoded += HEX.charAt(charCode & 0xF); 
                } 
            } 
        }
        return encoded; 
    }
