function infoPopup(productId,groupId,subgroupId)
{
  day = new Date();
  id = day.getTime();
  var regexS = "[\\?&]session=([A-Za-z0-9^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if ( results == null ) 
  	infoPage = "/tuoteinfo/" + encodeURIComponent(productId) + "?pid="+id.toString();
  else
  	infoPage = "/tuoteinfo/" + encodeURIComponent(productId) + "?pid="+id.toString() + "&session=" + results[1];
  eval("page" + id + " = window.open(infoPage, '" + id + "', 'toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=0,width=790,height=600');");
}

function formatTitle(title, currentArray, currentIndex, currentOpts) {
	var title = '<div id="tip7-title">' + (title && title.length ? '<b>' + title + '</b>' : '' ) + 'Kuva ' + (currentIndex + 1) + '/' + currentArray.length;
	
	// edellisen kuvan linkki
	if( currentIndex > 0 )
		title += ' <a href="javascript:;" onclick="$.fancybox.prev();">&lt;edellinen</a> ';
	// seuraavan kuvan linkki
	if( currentIndex + 1 < currentArray.length )
		title += ' <a href="javascript:;" onclick="$.fancybox.next();">seuraava &gt;</a>';
		
	title += '</div>';
	return title
}


function scardaddhelper(code,id){winHandle = window.open('',id.toString());winHandle.scardadd( code );}

function scardadd( code )
{
	$.fancybox({
		'width'				: 400,
		'height'			: 250,
		'autoScale'     	: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'href'				: '/scardadd/'+encodeURIComponent(code)
	});
	
	$.fancybox.resize();
}

function resizeFancyBox(height){var content = $('#fancybox-content');content.css({ height: height });$.fancybox.center();} 

$(document).ready(function() {
	$("a.lpimg").fancybox({ 'showCloseButton' : true, 'titlePosition': 'inside', 'titleFormat': formatTitle });
	
	$( "#ptabs" ).tabs();
	
	$( "#aosamaksu" ).click(function() {
		$( "#ptabs" ).tabs( 'select', 2 );
	});
	
	/*
	var slider = $('.sisslider').bxSlider({
		pager: false,
		controls: true,
		auto: true, 
		speed: 2000,
		pause: 5000,
		randomStart: true,
		displaySlideQty: 8,
		moveSlideQty: 2,
		autoHover: true,
		easing: 'easeInOutQuad'
	});
	
	$('sisslider_prev').click(function() {
		slider.goToPreviousSlide();
		return false;
	});
	
	$('sisslider_next').click(function() {
		slider.goToNextSlide();
		return false;
	});
	*/
});
