/*!
Tuunix Oy
2011-01
äö
*/
// wait for the DOM to be loaded (function($) { 
$j=jQuery.noConflict(); //videoBox needs
jQuery(document).ready(function($j){

//loaded



$j('#piilotoggle1').bind('click', piilo);
$j('#piilotoggle2').bind('click', piilo);
$j('#piilotoggle3').bind('click', piilo);

/*
$jQuery('#piilotoggle2').click(piilo('piilotus2'));
$jQuery('#piilotoggle3').click(piilo('piilotus3'));
*/

$j('div[id^="piilotus"]').hide();
$j('#piilotus1').show("slow");

// FORM SIVU
$j("#nimi").maxLength(30);
$j("#maili").maxLength(30);
$j("#viesti").maxLength(600);


//tuotesivu

//bind
var hiiritimer=1;

$j('#hiiri1').hover(
  function () {
  if(hiiritimer==1) 
		{
		setTimeout(function(){hiiritimer=1}, 20);
		
		hiiritimer=0;
		$j(this).addClass("underline");
		$j('#hiiri_info4').show();
		$j('#hiiri_info5').hide();
		$j('#hiiri_info6').hide();
		}
    //$(this).css('right', '0px');
  },
   function () {
    $j(this).removeClass("underline");
	//$(this).css('right', '-5px');
  }

);
$j('#hiiri2').hover(
  function () {
    if(hiiritimer==1) 
		{
		setTimeout(function(){hiiritimer=1}, 20);
		
		hiiritimer=0;
		$j(this).addClass("underline");
		$j('#hiiri_info5').show();
		$j('#hiiri_info4').hide();
		$j('#hiiri_info6').hide();
		}
    //$(this).css('right', '0px');
  },
   function () {
    $j(this).removeClass("underline");
	//$(this).css('right', '-5px');
  }

);
$j('#hiiri3').hover(
  function () {
if(hiiritimer==1) 
	{
	setTimeout(function(){hiiritimer=1}, 20);
	
	hiiritimer=0;
	$j(this).addClass("underline");
	$j('#hiiri_info6').show();
	$j('#hiiri_info4').hide();
	$j('#hiiri_info5').hide();
	}
    //$(this).css('right', '0px');
  },
   function () {
    $j(this).removeClass("underline");
	//$(this).css('right', '-5px');
  }

);



/*
$('.piilotoggle3').click(piilo);
$('.piilo3').hide();
*/


function piilo(keepvisible) {
//if(!keepvisible)return false;
//alert($jQuery('#piilotus1').length);
$j('div[id^="piilotus"]').hide("slow");

if($j(this).next('div').css("display") !='block')
	{
	$j(this).next('div').show("slow");
	}
else $j(this).next('div').hide("slow");

//alert($j(this).next('div').css("display"));


/*
if(keepvisible.length >0)
	{
	$j('#'+keepvisible).show("slow");
	}
	
*/
/*
if(!keepvisible)
	{
	$j('#'+keepvisible).show("slow");
	}
*/
//($j(this).


return false;
}


});
//readyfunctionloppu

 
	//document.getElementById('slideout').style.display='block';
	
// --- omat

// $('.kortti').click(korttiselector);
// $('#toimitustapa').change(toimitustapaselector);
// $('#kaveri').hide();


// $('.piilotoggle1').click(piilo);
// $('.piilotoggle2').click(piilo);
// $('.piilotoggle3').click(piilo);
// $('.piilo2').hide();
// $('.piilo3').hide();


var piiloaika;
piiloaika=1;

function piilotusAlue(id,flagit) {
if (flagit=="1"){
if (document.layers) document.layers[''+id+''].visibility = "show"
else if (document.all) document.all[''+id+''].style.visibility = "visible"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
}
else
if (flagit=="0"){
if (document.layers) document.layers[''+id+''].visibility = "hide"
else if (document.all) document.all[''+id+''].style.visibility = "hidden"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
}}

function change(picture) {
document.taitaja.src = picture
}

function tube(suunta)
{
if(suunta)
	{
	document.getElementById('taitaja').style.width='37%';
	document.getElementById('taitaja').style.zIndex='200';
	}
else
	{
	document.getElementById('taitaja').style.width='40%';
	document.getElementById('taitaja').style.zIndex='3';
	}
}

function asetaaika(){
piiloaika=1;
}

function sendText(e, text) 
{ 
  e.value = text 
}

function toggle_visibility(id) {
       var e = document.getElementById(id);
	   if(piiloaika)
	   {
	   piiloaika=0;
       if(e.style.display == 'block' || e.style.display =='')
          e.style.display = 'none';
       else
          e.style.display = 'block';
	   
	   setTimeout("asetaaika()",250);
	   }
    return false;
	}



function sendText(e, text) 
{ 
  e.value = text 
}

