var System = {
    Cache: {},
    url: location.href
};

System.Flash = {
    show: function(element, flash, width, height) {
        element.innerHTML = '\
            <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'" align="middle">\
            <param name="allowScriptAccess" value="sameDomain" />\
            <param name="movie" value="'+flash+'" />\
            <param name="quality" value="high" />\
            <param name="bgcolor" value="#ffffff" />\
            <param name="wmode" value="transparent" />\
            <embed src="'+flash+'" quality="high" bgcolor="#ffffff" width="'+width+'" height="'+height+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\
            </object>';
    }
}

System.OutPut = {
    showIn: function(aim, source) {
        if ($(aim) && $(source))
            $(aim).innerHTML = $(source).innerHTML;
    }
}

function $(id) {
    return document.getElementById(id) || false;
}

function $$(n) {  
    var el = [], _el = document.getElementsByTagName('*');
    for (var i=0; i<_el.length; i++) {
        if (_el[i].className == n) {
            el[el.length] = _el[i];
        }
    } 
    return el;
} 

function showtab(btnid, tabid, tabnumber, barid){
    for (i = 1;i<=tabnumber;i++) {
        $(barid+"_btn"+i).className = "";
        $(tabid+"_sub"+i).className = "hide";
    }
    $(barid+"_btn"+btnid).className = "focus";
    $(tabid+"_sub"+btnid).className = "show";
}

function resizeImg(id, width) {
    var imgElements = $(id).getElementsByTagName("IMG");
    for (var i = 0; i < imgElements.length; i++) {
        if (imgElements[i].width > width) {
            imgElements[i].style.width = width + "px";
            imgElements[i].style.height = width*imgElements[i].height/imgElements[i].width + 'px';
        }
    }
}
