//create rolling content to rullauutinen
var counter = 0;
function slide1(){
   $('#rivi-3').hide("fast");
   $('#rivi-1').show("slow");
   setTimeout(slideNews, 8000);
}
function slide2(){
   $('#rivi-1').hide("fast");
   $('#rivi-2').show("slow");
   setTimeout(slideNews, 8000);
}
function slide3(){
   $('#rivi-2').hide("fast");
   $('#rivi-3').show("slow");
   setTimeout(slideNews, 8000);
}

function slideNews(){
counter = counter + 1;
(counter>3)?counter=1:counter=counter;
switch(counter){
case 1:
slide1();
break;
case 2:
slide2();
break;
case 3:
slide3();
break;
}
}
var $lomaketeksti = '';
function lisaaLomakeTeksti(){
$lomaketeksti = '<div class="entry"><p style="text-align: left;"><div class="wpcf7" id="wpcf7-f3-p128-o1"><form action="';



if(location.href == 'http://www.kassone.com/') {
$lomaketeksti += 'http://www.kassone.com';
} else {
$lomaketeksti += location.href;
}
$lomaketeksti +='#wpcf7-f3-p128-o1" method="post" class="wpcf7-form">';
$lomaketeksti +='<div style="display: none;">';
$lomaketeksti +='<input type="hidden" name="_wpcf7" value="2" />';
$lomaketeksti +='<input type="hidden" name="_wpcf7_version" value="2.1" />';
$lomaketeksti +='<input type="hidden" name="_wpcf7_unit_tag" value="wpcf7-f3-p128-o1" /></div>';
$lomaketeksti +='<p>Nimesi (vaadittu)<br />';
$lomaketeksti +='<span class="wpcf7-form-control-wrap your-name"><input type="text" name="your-name" value="" class="wpcf7-validates-as-required" size="40" /></span> </p>';
$lomaketeksti +='<p>Sähköpostiosoitteesi (vaadittu)<br />';
$lomaketeksti +='<span class="wpcf7-form-control-wrap your-email"><input type="text" name="your-email" value="" class="wpcf7-validates-as-email wpcf7-validates-as-required" size="40" /></span> </p>';
$lomaketeksti +='<p>Otsikko<br />';
$lomaketeksti +='<span class="wpcf7-form-control-wrap your-subject"><input type="text" name="your-subject" value="" size="40" /></span> </p>';
$lomaketeksti +='<p>Viesti<br />';
$lomaketeksti +='<span class="wpcf7-form-control-wrap your-message"><textarea name="your-message" cols="40" rows="10"></textarea></span> </p>';
$lomaketeksti +='<p><input type="submit" value="Lähetä" /> <img class="ajax-loader" style="visibility: hidden;" alt="ajax loader" src="http://www.kassone.com/wp-content/plugins/contact-form-7/images/ajax-loader.gif" /></p>';
$lomaketeksti +='<div class="wpcf7-response-output wpcf7-display-none"></div></form></div></p></div>';
}

// Create the tooltips only on document load
$(document).ready(function() 
{     
// start news ticker
slideNews();
$.superbox.settings = {
	boxId: "superbox", // Id attribute of the "superbox" element
	boxClasses: "", // Class of the "superbox" element
	overlayOpacity: .6, // Background opaqueness
	boxWidth: "600", // Default width of the box
	boxHeight: "400", // Default height of the box
	loadTxt: "Ladataan...", // Loading text
	closeTxt: "Sulje", // "Close" button text
	prevTxt: "Edellinen", // "Previous" button text
	nextTxt: "Seuraava" // "Next" button text
};
$.superbox();

$('#nav  a[href][title]').qtip({
      content: {
         text: false // Use each elements title attribute
      },
      position: {
                  corner: {
                     tooltip: 'bottomMiddle', // Use the corner...
                     target: 'topMiddle' // ...and opposite corner
                  }
                  },
     style: { 
      padding: 5,
	  'padding-left': '10px',
	  'padding-right': '10px',
	  'background-repeat': 'repeat-x',
 background: '#dce9f3',
         'background-image': 'url(http://www.kassone.com/wp-content/themes/kassone/images/tooltipBg.jpg)',
         'background-repeat': 'repeat-x',
         color: '#4888c4',
         overflow: 'hidden',
         textAlign: 'center',
         'font-family': 'Helvetica, Arial, sans-serif',
         'font-size': '12px',
         'text-transform': 'uppercase',
      border: {
         width: 3,
         radius: 5,
         color: '#fff'
      },
      tip: true,
	 
      name: 'dark' // Inherit the rest of the attributes from the preset dark style
   }
   });
   $('a[id="home"]').qtip("destroy");
      $('a[id="home"]').qtip({
      content: {
         text: "Etusivu"// Use each elements title attribute
      },
      position: {
                  corner: {
                     tooltip: 'bottomMiddle', // Use the corner...
                     target: 'center' // ...and opposite corner
                  }
                  },
     style: {
		 padding: 5,
	  'padding-left': '10px',
	  'padding-right': '10px',
		  background: '#dce9f3',
         'background-image': 'url(http://www.kassone.com/wp-content/themes/kassone/images/tooltipBg.jpg)',
         'background-repeat': 'repeat-x',
         color: '#4888c4',
         overflow: 'hidden',
         'textAlign': 'left',
         'font-family': 'Helvetica, Arial, sans-serif',
         'font-size': '12px',
         'text-transform': 'uppercase',
                  border: {
                     width: 3,
                     radius: 5,
					 color: '#fff'
                  },
                  padding: 5, 
                  textAlign: 'center',
                  tip: true
               }
   });
   
   
   // NOTE: You can even omit all options and simply replace the regular title tooltips like so:
   // $('#content a[href]').qtip();  

   // Create the modal backdrop on document load so all modal tooltips can use it
   $('<div id="qtip-blanket">')
      .css({
         position: 'absolute',
         top: $(document).scrollTop(), // Use document scrollTop so it's on-screen even if the window is scrolled
         left: 0,
         height: $(document).height(), // Span the full document height...
         width: '100%', // ...and full width

         opacity: 0.6, // Make it slightly transparent
         backgroundColor: 'black',
         zIndex: 5000  // Make sure the zIndex is below 6000 to keep it below tooltips!
      })
      .appendTo(document.body) // Append to the document body
      .hide(); // Hide it initially
   
   
   
});