﻿var inaltime;
var prima = 1;
var initialinaltime;
function scrollup() {
    var cutie = document.getElementById("cutiescroll");
    inaltime = cutie.scrollHeight;
    if (prima == 1) {
        initialinaltime = cutie.scrollTop; //cat cuprinde un ecran de scroll
        prima = 0;
        return;
    }
    if (cutie.scrollTop > initialinaltime) {
        if (cutie.scrollTop - 50 > initialinaltime) cutie.scrollTop = cutie.scrollTop - 50;
        else cutie.scrollTop = initialinaltime;

    }

}

function scrolldown() {


    var cutie = document.getElementById("cutiescroll");
    var sageata = document.getElementById("sageatajos");
    inaltime = cutie.scrollHeight;
    if (prima == 1) {

        initialinaltime = cutie.scrollTop; //cat cuprinde un ecran de scroll
        prima = 0;
    }
    if (cutie.scrollTop + 50 <= cutie.scrollHeight) cutie.scrollTop = cutie.scrollTop + 50;
    else cutie.scrollTop = cutie.scrollHeight;


}
function mo(id) {
    var buton = document.getElementById(id);
    buton.src = "PICS/m" + id + ".png";
    //inchide alte meniuri flotante

    inchide();


}
function mt(id) {
    var buton = document.getElementById(id);
    buton.src = "PICS/" + id + ".png";

}


var perioada = 500;
var timerinchidere = 0;
var curent = 0;
var buton = 0;
var fostul = "";
function produse_onclick() {
    curent = document.getElementById("pc");
    curent.style.visibility = "visible";
    buton = document.getElementById("produse");
    fostul = buton.src;
    buton.src = "PICS/mproduse.png";


}

function nuinchide() {
    if (timerinchidere) {
        window.clearTimeout(timerinchidere);
        timerinchidere = null;
    }
}
function incepeinchide() {
    timerinchidere = window.setTimeout(inchide, perioada);
}
function inchide() {


    if (curent) curent.style.visibility = 'hidden';
    if (buton) buton.src = fostul;
}
function deschidepc() {

    // cancel close timer
    nuinchide();

    // close old layer
    if (curent) curent.style.visibility = "hidden";
    if (buton) buton.src = fostul;
    //alert(id);
    // get new layer and show it
    curent = document.getElementById("pc");
    curent.style.visibility = "visible";
    buton = document.getElementById("produse");
    fostul = "PICS/produse.png";
    buton.src = "PICS/mproduse.png";
}

function deschidemeniuprod(numar) 
{
    // cancel close timer
    nuinchide();

    // close old layer
    if (curent) curent.style.visibility = "hidden";
    if (buton) buton.src = fostul;
//    alert(numar);
    // get new layer and show it
    curent = document.getElementById("P"+numar);
    curent.style.visibility = "visible";
//    buton = document.getElementById("produse");
//    fostul = "PICS/produse.png";
//    buton.src = "PICS/mproduse.png";


}

function deschideserv() {

    // cancel close timer
    nuinchide();

    // close old layer
    if (curent) curent.style.visibility = "hidden";
    if (buton) buton.src = fostul;
    //alert(id);
    // get new layer and show it

    curent = document.getElementById("sv");
    curent.style.visibility = "visible";
    buton = document.getElementById("servicii");
    fostul = "PICS/servicii.png";
    buton.src = "PICS/mservicii.png";
}

document.onclick = inchide;

function home_onclick() {
    window.location = "home.aspx";
}

function cariere_onclick() {
    window.location = "cariere.aspx";
}

function cataloage_onclick() {
   window.location = "Cataloage.aspx";
}


function desprenoi_onclick() {
    window.location = "desprenoi.aspx";
}

function contact_onclick() {
    window.location = "contact.aspx";
}
function download_onclick() {

    window.location = "download.aspx";
}

function certificatISO() {
    window.location = "ROMSANCertificatSRENISO90012001.aspx";
}

function certificatISOMare() {
    window.location = "CertificatISO9001.aspx";
}

function displayharta() {
    //deschidem harta in fereastra noua
    window.open("DisplayHarta.htm", "new", "height=490,width=555,resizeable=no,location=no,menu=no");
}
function makevisible() {
    var divmain = document.getElementById("maindiv");
    // alert("here");
    divmain.style.visibility = "visible";

}
var pos = 0;
var mouseover=0;
function scrollIt() {

    var news = document.getElementById('NewsArea');
    news.scrollTop = pos; 
    if (mouseover==0) pos++;  // specifies left / right or top / bottom.
    if (pos > news.scrollHeight-70) pos = 0;

    setTimeout('scrollIt()', 50);
}

function scroll_mo()
{
mouseover = 1;
}

function scroll_mout()
{
mouseover = 0;
}

//var currentpos=0,alt=1,curpos1=0,curpos2=-1

//function initialize(){

//startit()

//}

//function scrollwindow(){

//if (document.all &&

//!document.getElementById)

//temp=document.body.scrollTop

//else

//temp=window.pageYOffset

//if (alt==0)

//alt=2

//else

//alt=1

//if (alt==0)

//curpos1=temp

//else

//curpos2=temp

//if (curpos1!=curpos2){

//if (document.all)

//currentpos=document.body.scrollTop+speed

//else

//currentpos=window.pageYOffset+speed

//window.scroll(0,currentpos)

//}

//else{

//currentpos=0

//window.scroll(0,currentpos)

//}

//}

//function startit(){

//setInterval("scrollwindow()",50)

//}

//window.onload=initialize

//<script language="JavaScript1.2"> 
//// Distributed by http://www.hypergurl.com // Scrollers width here (in pixels) 
//var scrollerwidth="450px" // Scrollers height here var scrollerheight="100px" 
//// Scrollers speed here (larger is faster 1-10) var scrollerspeed=2 
//// Scrollers content goes here! Keep all of the message on the same line! 
//var scrollercontent=''
//var pauseit=1 // Change nothing below! scrollerspeed=(document.all)? 
//scrollerspeed : Math.max(1, scrollerspeed-1) //slow speed down by 1 for NS var 
//copyspeed=scrollerspeed 
//var iedom=document.all||document.getElementById 
//var actualheight='' 
//var cross_scroller, ns_scroller 
//var pausespeed=(pauseit==0)? copyspeed: 0 
//function populate()
//{
// if (iedom)
// {
//  cross_scroller=document.getElementById? document.getElementById("iescroller") : document.all.iescroller cross_scroller.style.top=parseInt(scrollerheight)+8+"px" 
//cross_scroller.innerHTML=scrollercontent actualheight=cross_scroller.offsetHeight 
//} 
//else if (document.layers){ ns_scroller=document.ns_scroller.document.ns_scroller2 
//ns_scroller.top=parseInt(scrollerheight)+8 ns_scroller.document.write(scrollercontent) 
//ns_scroller.document.close() actualheight=ns_scroller.document.height } lefttime=setInterval("scrollscroller()",20) 
//} window.onload=populate function scrollscroller(){ if (iedom){ if (parseInt(cross_scroller.style.top)>(actualheight*(-1)+8)) 
//cross_scroller.style.top=parseInt(cross_scroller.style.top)-copyspeed+"px" 
//else cross_scroller.style.top=parseInt(scrollerheight)+8+"px" } else 
//if (document.layers){ if (ns_scroller.top>(actualheight*(-1)+8)) ns_scroller.top-=copyspeed 
//else ns_scroller.top=parseInt(scrollerheight)+8 } } if (iedom||document.layers){ 
//with (document){ if (iedom){ write('<div style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden" 
//onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=scrollerspeed">') 
//write('<div id="iescroller" style="position:absolute;left:0px;top:0px;width:100%;">') 
//write('</div></div>') } else if (document.layers){ write('<ilayer 
//width='+scrollerwidth+' height='+scrollerheight+' name="ns_scroller">') 
//write('<layer name="ns_scroller2" width='+scrollerwidth+' height='+scrollerheight+' 
//left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=scrollerspeed"></layer>')
//write('</ilayer>') } } } </script>

function deschidecategorie(i) {
   
    switch (i) {
        case 1:
            window.location = "ProduseCategorie.aspx?id=" + i + "&Name=SculePentruDebitare";
            break;
        case 2:
            window.location = "ProduseCategorie.aspx?id=" + i + "&Name=SculePentruStrunjire";
            break;
        case 3:
            window.location = "ProduseCategorie.aspx?id=" + i + "&Name=SculePentruFrezare";
            break;
        case 4:
            window.location = "ProduseCategorie.aspx?id=" + i + "&Name=SculePentruGaurire";
            break;
        case 5:
            window.location = "ProduseCategorie.aspx?id=" + i + "&Name=SculePentruAlezare";
            break;
        case 6:
            window.location = "ProduseCategorie.aspx?id=" + i + "&Name=SculePentruFiletare";
            break;
        case 7:
            window.location = "ProduseCategorie.aspx?id=" + i + "&Name=Calibre";
            break;
        case 8:
            window.location = "ProduseCategorie.aspx?id=" + i + "&Name=Portscule";
            break;
        case 9:
            window.location = "ProduseCategorie.aspx?id=" + i + "&Name=UnelteDeMana";
            break;
        case 10:
            window.location = "ProduseCategorie.aspx?id=" + i + "&Name=Diverse";
            break;
    }

}
