function activate0(idi)
{
}

function activate(idi)
{	
	$(function() {
	

	$("#thumbnails"+idi).scrollable({size: 3, clickable: false, next:'#next'+idi, prev:'#prev'+idi});
	// enable reflections
	$("#thumbnails"+idi+" img").reflect({height: 0.5, opacity: 0.6}); 

	// scrollable inside the box.
	$("#images"+idi).scrollable();



	}); /* Jquery call */

}

var saved = {};
var savedlastid = null;

function hasclassname(el, c)
{
	return (' '+el.className+' ').indexOf(' '+c+' ') >= 0;
}

function scroll_over(el, id, idi)
{
	idi='';
//	alert(document.getElementById('medium_'+id).style.display);
//alert(document.getElementById('medium_'+id).innerHTML);
	//alert($('#medium_'+id).parent());
	//alert(1);
	var eloffset=$(el.parentNode).offset();
	var nxoffset=$('#next'+idi).offset();
	
	var d=nxoffset.left - eloffset.left;

	if(d<195) {
		//var index = $("#thumbnails").data("scrollable").getIndex();
		//$("#thumbnails").data("scrollable").seekTo(index + 1, 500);
		return;
	}
/*
	d=$(el.parentNode).offset().left - $('#prev'+idi).offset().left;
	if(d<100) {
		var index = $("#thumbnails").data("scrollable").getIndex();
		if(index > 0) {
			$("#thumbnails").data("scrollable").seekTo(index - 1, 500);
			return;
		}
	}
*/
	if(savedlastid) 
		{ if(savedlastid != id) scroll_out(null,savedlastid); }
	savedlastid = id;
	
	
	var srcel = $(el).parents('.thumb_parent');
	
	//var myel = document.getElementById('medium_'+id);

	//if((''+window.location).indexOf('check') > 0) {
	var	myel = document.getElementById('medium_'+srcel.find('.mid').get(0).value);
	//}

	engage(srcel, $(myel));
	
	myel.style.left=eloffset.left+'px';
	myel.style.top=eloffset.top+'px';

	
	//$('#medium_'+id).find('.color_medium_thumb_holder').css({'opacity':0});
	$(myel).find('.medium_item').css({'opacity':0});
	
	$(myel).get(0).style.display='inline';
//	document.getElementById('medium_'+id).style.display='inline';
	
	
	////$('#medium_'+id).find('.color_medium_thumb_holder').animate({'opacity': 1});

	//$('#medium_'+id).find('.color_medium_thumb_holder').stop().fadeTo('normal', 1).show();
	$(myel).find('.medium_item').stop().fadeTo('normal', 1).show();


}

function scroll_out(el, id)
{
	
	//$('#medium_'+id).find('.color_medium_thumb_holder').stop();
	/*
	$('#medium_'+id).find('.medium_item').stop();
	document.getElementById('medium_'+id).style.display='none';
	*/

	$('#medium_mid_id_t1').find('.medium_item').stop();
	document.getElementById('medium_mid_id_t1').style.display='none';
	$('#medium_mid_id_t2').find('.medium_item').stop();
	document.getElementById('medium_mid_id_t2').style.display='none';
}

function mnuover(thi)
{
	$(thi).stop().animate({'background-color':'#aaaaaa'});
}

function mnuout(thi)
{
	$(thi).stop().animate({'background-color':$(thi).parents(
		'.medium_contents').find('.medium_last_row').css('background-color')});
}

function seomnuover(thi)
{
	$(thi).stop().animate({'background-color':'#aaaaaa'});
}

function seomnuout(thi)
{
	$(thi).stop().animate({'background-color':$(thi).parents(
		'.seomedium_contents').find('.medium_last_row').css('background-color')});
}


var ovl=null;

function enlarge(el, id, idi)
{
	//if((''+window.location).indexOf('check')>1) alert(el);
	//if((''+window.location).indexOf('check')>1) alert(id);
	//alert(1);
	idi='';
	//if(!ovl)
	//ovl = 
	//$(el).overlay({
	var link = document.createElement('span');
	el.parentNode.appendChild(link);

	$(link).overlay({

			top: 0,
			effect: 'apple',
			target: '#ll'+id,
			mask: { maskId: 'mask' },
			oneInstance  	:true,
			fixed: false,

			// when box is opened, scroll to correct position (in 0 seconds)
			onLoad: function() {
				//this.getConf().target = '#llw'+id;
				/*var i=$('#ll'+id).find('.boxim').get(0);
				i.src=i.title;
				i.width=500;
				i.height=600;
				i.style.left='70px';*/
				//$('#ll'+id).find('.boxim').fadeIn(500);
			},
			onBeforeClose: function() {
				/*var i=$('#ll'+id).find('.boxim').get(0);
				i.src='';
				i.style.opacity='0';*/
			},
			load: true
		});

		// output the name and value of all the objects properties

}

function readef(el, id, idi)
{
	//alert(1);
	idi='';
	window.location='index.php?p=19&id_d='+id;

}

function editions(el, id, idi, idk)
{
	//alert(1);
	idi='';
	window.location='index.php?p=35&id_kat='+idk;


}

function message(el, id, idi, idk)
{
	//alert(1);
	idi='';
	$.prettyPhoto.open('index.php?p=34&ekdotis_id_v='+idk+'&iframe=true&width=70%&height=100%','','');


}

function infos(el, id, idi, idk)
{
	//alert(1);
	idi='';
	//window.location='index.php?p=40&ekdotis_id_v='+idk;

	$.prettyPhoto.open('index.php?p=40&ekdotis_id_v='+idk+'&id='+id+'&iframe=true&amp;width=600&amp;height=300','','');

}

function engage(s,w)
{
	//var w=$(bid);
	//var s=$(sid);
	//if((''+window.location).indexOf('check') > 0) {} else return;

	var id = s.find('.mid_id').get(0).value;
	var idk = s.find('.mid_idk').get(0).value;
	var mid_title = s.find('.mid_title').get(0).value;
	var mid_provoles = '('+s.find('.mid_provoles').get(0).value+')';
	var mid_thumb = s.find('.mid_thumb').get(0).value;
	
	w.find('.medium_top_text').html(mid_title);
	w.find('.medium_thumb').get(0).src = mid_thumb;

	w.find('.medium_border').unbind('mouseout');
	w.find('.medium_border').mouseout(function(){scroll_out(this,id)});
	w.find('.medium_border').unbind('mouseover');
	w.find('.medium_border').mouseover(function(){scroll_out(this,id)});
	w.find('.medium_menu_bar').unbind('mouseout');
	w.find('.medium_menu_bar').mouseout(function(){mnuout(this);});
	w.find('.medium_menu_bar').unbind('mouseover');
	w.find('.medium_menu_bar').mouseover(function(){mnuover(this);});

	w.find('.item_provoles').html(mid_provoles);

	w.find('.enlargeit').unbind('click');
	//w.find('.enlargeit').get(0).rel = '#ll'+id;
	w.find('.enlargeit').click(function(){enlarge(this,id);});
	
	w.find('.act_readef').unbind('click');
	w.find('.act_readef').click(function(){readef(this,id);});
	w.find('.act_editions').unbind('click');
	w.find('.act_editions').click(function(){editions(this,id,'',idk);});
	w.find('.act_message').unbind('click');
	w.find('.act_message').click(function(){message(this,id,'',idk);});
	w.find('.act_infos').unbind('click');
	w.find('.act_infos').click(function(){infos(this,id,'',idk);});
	if((''+window.location).indexOf('check')>0) alert(id);
}

