function insert_flash() {
    document.getElementById("flash_div").innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='988' height='450' title='PRQA'><param name='wmode' value='transparent' /><param name='movie' value='accelerate.swf' /><param name='quality' value='high' /><embed src='accelerate.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='988' height='450' wmode='transparent'></embed></object>";
}
function showmenu(elmnt)
{
    document.getElementById(elmnt).style.visibility="visible";
}
function hidemenu(elmnt)
{
    document.getElementById(elmnt).style.visibility="hidden";
}    

//management.html
function open_close(id1, id2) {
    if (document.getElementById(id2).style.display == "block") {
        document.getElementById(id1).className = "level2";
    }
    else {
        document.getElementById(id1).className = "level2 level2_expanded";
    }
    animatedcollapse.toggle(id2);
}
function only_open(id1, id2) {
    if (document.getElementById(id2).style.display == "block") {
        return;
    }
    else {
        document.getElementById(id1).className = "level2 level2_expanded";
        animatedcollapse.toggle(id2);
    }
}
function only_close(id1, id2) {
    if (document.getElementById(id2).style.display != "block") {
        return;
    }
    else {
        document.getElementById(id1).className = "level2";
        animatedcollapse.toggle(id2);
    }
}

       
//tabs
function tab_view(menu_prefix, content_prefix, tab_count, idx) {
    var id;        
    for(id = 1; id <= tab_count; id++) {
        if (idx == id) {
            document.getElementById(menu_prefix + id).className = "selected";
            if (document.getElementById(content_prefix + id).style.display != "block") {
                animatedcollapse.toggle(content_prefix + id);
            }                                     
        }                         
        else {
            document.getElementById(menu_prefix + id).className = "";
            if (document.getElementById(content_prefix + id).style.display == "block") {
                animatedcollapse.toggle(content_prefix + id);
            }
        }    
    }
}


//partners.html
function tab_view2(menu_prefix, content_prefix, idx) {
    if (document.getElementById(menu_prefix + idx).className == "partner_title") {
        document.getElementById(menu_prefix + idx).className = "partner_title partner_title_selected";
    }
    else {
        document.getElementById(menu_prefix + idx).className = "partner_title";
    }
    animatedcollapse.toggle(content_prefix + idx);
}

function tab_view3(menu_prefix, content_prefix, tab_count, idx) {
    var id;        
    for(id = 1; id <= tab_count; id++) {
        if (idx != id) {
            document.getElementById(menu_prefix + id).className = "partner_title";
            if (document.getElementById(content_prefix + id).style.display == "block") {
                animatedcollapse.toggle(content_prefix + id);
            }
        }    
    }
    if (document.getElementById(menu_prefix + idx).className == "partner_title") {
        document.getElementById(menu_prefix + idx).className = "partner_title partner_title_selected";
    }
    else {
        document.getElementById(menu_prefix + idx).className = "partner_title";
    }
    animatedcollapse.toggle(content_prefix + idx);
}

function tab_view4(content_prefix, idx) {
    animatedcollapse.toggle(content_prefix + idx); 
}

//Press Enter on search
function keyinSearch(evt) {
    if (evt.keyCode == 13) {
        document.search.submit();
    }
}

//Get Position of object
function get_objTop(thisobj){
    if(typeof(thisobj)!='object') thisobj=document.getElementById(thisobj);
    if(thisobj==null) return 0;
    if (thisobj.offsetParent==document.body) return thisobj.offsetTop;
    else return thisobj.offsetTop + get_objTop(thisobj.offsetParent) - thisobj.scrollTop;
}

function get_objLeft(thisobj){
    if(typeof(thisobj)!='object') thisobj=document.getElementById(thisobj);
    if(thisobj==null) return 0;
    if (thisobj.offsetParent==document.body) return thisobj.offsetLeft;
    else return thisobj.offsetLeft + get_objLeft(thisobj.offsetParent) - thisobj.scrollLeft;
}

//Slide show
function view_next_slide(sub_div, current_idx, display_limit, img_height, time) {
    var next_idx;
    if (current_idx == 1)
        next_idx = 2;
    else
        next_idx = 1;
    animatedcollapse.toggle(sub_div + current_idx);
    var idx;
    var div = document.getElementById(sub_div + next_idx);
    var innerHTML = "<div style='width: 1000px;'>";
    var imgs = new Array();
    for (idx = 0; idx < display_limit; idx++) {
        var id;
        var p = true;
        while(p == true) {
            id = Math.floor(Math.random() * 10000 % images.length);
            p = false;
            var idx1;
            var tmp = "";
            for (idx1 = 0; idx1 < imgs.length; idx1 ++) {
                if (imgs[idx1] == id) {
                    p = true;
                }
                tmp = tmp + " " + imgs[idx1];
            }
        }
        imgs[idx] = id;
        innerHTML = innerHTML + "<img src='" + images[id] + "' alt='' height='" + img_height + "' />";
    }
    innerHTML = innerHTML + "</div>";
    div.innerHTML = innerHTML;
    animatedcollapse.toggle(sub_div + next_idx);
    setTimeout("view_next_slide('" + sub_div + "', " + next_idx + ", " + display_limit + ", " + img_height + ", " + time + ");", time);
}

var images = new Array("images/nasa.png","images/voda.png","images/philips.png","images/visa.png","images/ray.png","images/volvo.png");
function make_scroll(display_div, sub_div, display_limit, img_height, time) {
    var idx;
    var innerHTML = "";
    
    var div = document.getElementById(display_div);
    div.style.height = (img_height+20) + "px";
    var subdiv1 = document.getElementById(sub_div + "1");
    var subdiv2 = document.getElementById(sub_div + "2");
    
    subdiv1.style.left = get_objLeft(display_div) + "px";
    subdiv1.style.top = get_objTop(display_div) + "px";
    subdiv2.style.left = get_objLeft(display_div) + "px";
    subdiv2.style.top = get_objTop(display_div) + "px";
    
    subdiv1.style.display = "block";
    setTimeout("view_next_slide('" + sub_div + "', 1, " + display_limit + ", " + img_height + ", "  + time + ");", 500);
}
