Core = {
        translit:   function(txt) {
                        res=txt;
                        var from=new Array('&#E0;', '&#E1;', '&#E2;', '&#E3;', '&#E4;', '&#E5;', '&#B8;', '&#E6;', '&#E7;', '&#E8;', '&#E9;', '&#EA;', '&#EB;', '&#EC;', '&#ED;', '&#EE;', '&#EF;', '&#F0;', '&#F1;', '&#F2;', '&#F3;', '&#F4;', '&#F5;', '&#F6;', '&#F7;', '&#F8;', '&#F9;', '&#FA;', '&#FB;', '&#FC;', '&#FD;', '&#FE;', '&#FF;');
                        var to=new Array('a', 'b', 'v', 'g', 'd', 'e', 'e', 'g', 'z', 'i', 'i', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'tc', 'ch', 'sh', 'sch', '', 'i', '', 'e', 'ju', 'ja');
                        for (i=0; i<from.length; i++)
                            while (res.indexOf(from[i])>=0)
                                res=res.replace(from[i], to[i]);
                        return res;
                    },
        displayBox: function(id, status) {
                        el = document.getElementById(id);

                        if (status != undefined) {
                            box_visibility = status;
                        } else {
                            box_visibility = (el.style.height != el.scrollHeight + "px") && (el.style.height != "100%");
                        }

                        if (box_visibility){
                            el.style.display = "";
                            el.style.visibility = "visible";
                            el.style.height = el.scrollHeight + "px";
                        } else {
                            el.style.visibility = "hidden";
                            el.style.display = "none";
                            el.style.height = "1px";
                        }
                        return false;
                    },
        makeSef:    function(from_name_id, to_name_id) {
                        text_from = document.getElementById(from_name_id);
                        text_to = document.getElementById(to_name_id);

                        sindex = text_from.selectedIndex;
                        str = text_from.options[sindex].text;
                        //    str = text_from.value;
                        ex = /\$|,|@|#|~|`|\%|\*|\^|\.|\&|\(|\)|\+|\=|\[|\]|\[|\}|\{|\;|\:|'|\"|\<|\>|\?|\||\\|\!|\$|\//g;
                        str = str.replace(ex, "");
                        ex = /^\s+|\s+$/g;
                        str = str.replace(ex, "");
                        ex = /\s+/g;
                        str = str.replace(ex, "_");
                        str = str.toLowerCase();
                        str = translit(str);
                        text_to.value = str;
                        //document.getElementById('sef_div').innerHTML = str;
                    },
        checkUrl:   function() {
                        text_to = document.getElementById('url');

                        str = text_to.value;
                        ex = /\$|,|@|#|~|`|\%|\*|\^|\.|\&|\(|\)|\+|\=|\[|\]|\[|\}|\{|\;|\:|'|\"|\<|\>|\?|\||\\|\!|\$|\//g;
                        str = str.replace(ex, "");
                        ex = /^\s+|\s+$/g;
                        str = str.replace(ex, "");
                        ex = /\s+/g;
                        str = str.replace(ex, "_");
                        str = str.toLowerCase();
                        str = translit(str);
                        text_to.value = str;
                    },
        
        buttonOnOff:    function(id, action) {
                            if (document.getElementById(id)) {
                                document.getElementById(id).disabled=(action=='on')?false:true;
                                document.getElementById(id).style.color=(action=='on')?"#000000":"#808080";
                            }
                        },
        setHeight:  function(id, nHeight) {
                        if (document.getElementById(id)) {
                            if (document.getElementById(id).offsetHeight < nHeight)
                                document.getElementById(id).style.height = nHeight + 'px';
                        }
                    },
        setActivity:    function(id, status) {
                            el=document.getElementById(id);
                            if (status != undefined) element_activity = (status == 0) ? false : true;
                            else element_activity = (el.disabled.value);

                            if (element_activity){
                                el.disabled = false;
                            } else {
                                el.disabled = true;
                            }
                            return false;
                        },
        checkAll:   function(oForm, cbName, checked) {
                        for (var i=0; i < oForm[cbName].length; i++) oForm[cbName][i].checked = checked;
                    },
                    
	    getPageSize: function() {
			var xScroll, yScroll;
			   
			if (window.innerHeight && window.scrollMaxY) {  
                xScroll = window.innerWidth + window.scrollMaxX;
			    yScroll = window.innerHeight + window.scrollMaxY;
            } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			    xScroll = document.body.scrollWidth;
			    yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			    xScroll = document.body.offsetWidth;
			    yScroll = document.body.offsetHeight;
			}
	        
	        var windowWidth, windowHeight;
	        
	        if (self.innerHeight) { // all except Explorer
	            if(document.documentElement.clientWidth){
	                windowWidth = document.documentElement.clientWidth; 
	            } else {
	                windowWidth = self.innerWidth;
	            }
	            windowHeight = self.innerHeight;
	        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
	            windowWidth = document.documentElement.clientWidth;
	            windowHeight = document.documentElement.clientHeight;
	        } else if (document.body) { // other Explorers
	            windowWidth = document.body.clientWidth;
	            windowHeight = document.body.clientHeight;
	        }   
	        
	        // for small pages with total height less then height of the viewport
	        if(yScroll < windowHeight){
	            pageHeight = windowHeight;
	        } else { 
	            pageHeight = yScroll;
	        }
	    
	        // for small pages with total width less then width of the viewport
	        if(xScroll < windowWidth){  
	            pageWidth = xScroll;        
	        } else {
	            pageWidth = windowWidth;
	        }
	    
	        return [pageWidth,pageHeight];
	    }
}

Cookie = {
            set:    function(name, value, expires, path, domain, secure) {
                        document.cookie = name + "=" + escape(value) +
                            ((expires) ? "; expires=" + expires : "") +
                            ((path) ? "; path=" + path : "") +
                            ((domain) ? "; domain=" + domain : "") +
                            ((secure) ? "; secure" : ""); 
                    },
            get:    function(name) {
                        var cookie = " " + document.cookie;
                        var search = " " + name + "=";
                        var setStr = null;
                        var offset = 0;
                        var end = 0;
                        if (cookie.length > 0) {
                            offset = cookie.indexOf(search);
                            if (offset != -1) {
                                offset += search.length;
                                end = cookie.indexOf(";", offset)
                                if (end == -1) {
                                    end = cookie.length;
                                }
                                setStr = unescape(cookie.substring(offset, end));
                            }
                        }
                        return(setStr);
                    }
        }

function refreshCaptchaOnSignUp() {
    
    var src='?do=getcaptcha&rand='+Math.random(999);
    img = new Image(200,50);
    img.src = src;
    document['CaptchaImage'].src=eval("img.src");

} 

