var root_location   = 'http://www.hurmos.com/';
var hs_kansio       = 'http://www.hurmos.com/highslide/graphics/';

var linkit = new Array();
var kuvat = new Array();
  	
kuvat[0]=root_location + "layout/hurmos-linkki-etusivu.png";
kuvat[1]=root_location + "layout/hurmos-linkki-etusivufx.png";
kuvat[2]=root_location + "layout/hurmos-linkki-palvelut.png";
kuvat[3]=root_location + "layout/hurmos-linkki-palvelutfx.png";
kuvat[4]=root_location + "layout/hurmos-linkki-portfolio.png";
kuvat[5]=root_location + "layout/hurmos-linkki-portfoliofx.png";
kuvat[6]=root_location + "layout/hurmos-linkki-yhteistyo.png";
kuvat[7]=root_location + "layout/hurmos-linkki-yhteistyofx.png";
kuvat[8]=root_location + "layout/hurmos-linkki-yhteystiedot.png";
kuvat[9]=root_location + "layout/hurmos-linkki-yhteystiedotfx.png";
kuvat[10]=root_location + "layout/hurmos-linkki-tarjouspyynto.png";
kuvat[11]=root_location + "layout/hurmos-linkki-tarjouspyyntofx.png";

for(i=0; i<kuvat.length; i++){
  	linkit[i] = new Image();
  	linkit[i].src=kuvat[i];		  
}//end for


var xmlhttp  = null;
var IEselain = true;

 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp =  null;
  }
 }

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
		IEselain=false;
	} catch (e) {
		xmlhttp=null;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=null;
	}
}


function teeAjaxKutsu(ajaxFile,parametrit,handleFunktio){
	if (xmlhttp!=null && xmlhttp.readyState !=0 && xmlhttp.readyState !=4) {

	}else{
	    xmlhttp.open("POST", ajaxFile, true);

	    xmlhttp.onreadystatechange = handleFunktio;
        xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlhttp.send(parametrit);
 	} //end if
}//end function
    
    var nostokuvanro=0;
    
    var kuvat = new Array();

    /**************************************************************************
    * Alustetaan sivulle tulevat kuvat, jotta onmouseover-efektit sujuisivat
    * sähäkämmin.
    ***************************************************************************/
    function alustaKuvat(){
        var parameters="";
        var url = root_location + "ajax/asiakas_kuvat.php";

    	if (xmlhttp!=null && xmlhttp.readyState !=0 && xmlhttp.readyState !=4) {

    	}else{
    	    xmlhttp.open("POST", url, true);

    	    xmlhttp.onreadystatechange = handleAsiakasKuvat;
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlhttp.send(parameters);
     	} //end if
    }//end function


    function handleAsiakasKuvat(){
        if (xmlhttp.readyState == 4) {
       	    if (xmlhttp.status == 200){
                var xmlDocument = xmlhttp.responseXML;

                var kuva        = xmlDocument.getElementsByTagName('kuva');

                for(i=0; i<kuva.length; i++){
                  	kuvat[i] = new Image();
                    kuvat[i].src = kuva[i].getAttribute('polku');
                    kuvat[i].title = kuva[i].getAttribute('title');
                }//end for

                if(document.getElementById('etusivu-portfolio-nosto')) luoNostokuvaSelaus();
            }//end if
        }//end if
    }//end function


    function luoNostokuvaSelaus(){
        document.getElementById('etusivu-portfolio-nosto').setAttribute('src', kuvat[nostokuvanro].src);
        document.getElementById('etusivu-portfolio-nosto').setAttribute('title', kuvat[nostokuvanro].title);
        document.getElementById('etusivu-portfolio-nosto').setAttribute('alt', kuvat[nostokuvanro].title);
        
        nostokuvanro++;
        
        if(nostokuvanro<kuvat.length){
            setTimeout('luoNostokuvaSelaus()',4000);
        }//end if
    }//end function
    

    function avaaKuva(url,leveys,korkeus){
        var win = window.open(url,
          'popup',
          'width=' + leveys + ', height=' + korkeus + ', ' +
          'location=no, menubar=no, ' +
          'status=no, toolbar=no, scrollbars=no, resizable=no');

        win.resizeTo(leveys, korkeus);
        win.focus();
    }//end if

    function naytaSolmut(arvo,esiin){
        if(document.getElementById(arvo).style.display=='none'){
            document.getElementById(arvo).style.display = 'block';
        }else{
            document.getElementById(arvo).style.display = 'none';
        }//end if
    }//end function

    function vaihdaKuva(otus,arvo,i){
        document.getElementById(otus).src=kuvat[i];
    }//end function
    
    function avaaPortfolio(nimi){
        avaaKuva(nimi,470,690);
    }//end function
    

    function kuvanVaihto(otus,uusipolku){
        otus.setAttribute('src',uusipolku);
    }//end function


