$(document).ready(function(){

$('.more-open,.more-artists .plus-icon').click(function(){
if($('.plus-icon').is('.minus')){
$('.plus-icon').removeClass('minus');
$('.plus-icon').attr('src','/_media/images/festival/plus.gif');
$('.more-open').attr('src','/_media/images/festival/more.gif');
}else{
$('.plus-icon').addClass('minus');
$('.plus-icon').attr('src','/_media/images/festival/minus.gif');
$('.more-open').attr('src','/_media/images/festival/less.gif');
}
$(this).parent().parent().parent().parent().parent().parent().next().find(".content").hide();
$('.and table .hide').toggle();
$(this).parent().parent().parent().parent().parent().parent().next().find(".content").show();
});

$('.view-hotel').live('click',function(){
$(this).html('סגור פרטים נוספים').removeClass('view-hotel').addClass('hide-hotel');
var parent = $(this).parent();
var hotel_id = $(this).attr('hotel_id');
var hotel_data = $('<div class="hotel-info-container"></div>');
hotel_data.load('/hotel_' + hotel_id,function(data){
$(this).appendTo(parent);
parent.parent().css({
'height':'auto',
'padding':'0 0 10px 0'
}
);
});
});

$('.view-location').live('click',function(){
if($(this).next('.location-details').is(':hidden')){
$(this).html('סגור פרטים נוספים');
$(this).parents('.info-title').css({
'height':'auto',
'padding':'0 0 10px 0'
});
}else{
$(this).html('לחצו כאן לפרטים נוספים');
$(this).parents('.info-title').css({
'height':'',
'padding':''
});
}
$(this).next('.location-details').toggle();
return false;
});

$('.hide-hotel').live('click',function(){
var parent = $(this).parent();
parent.find('.hotel-info-container').slideUp('slow',function(){
$(this).remove();
});
parent.parent().attr('style','');
$(this).html('לחצו כאן לפרטים נוספים').addClass('view-hotel').removeClass('hide-hotel');
});

$('.view-map').click(function(){
var show_id = $(this).attr('show_id');
var width = $(this).attr('img_width');
var height = $(this).attr('img_height');
window.open('/seatingmap_' + show_id,'map' + show_id,'width='+ width + ',height=' + height);
});

$('.show-gmap,.hide-gmap').live('click',function(){
$(this).parents('.hotel-info-container').find('.hotel-map').toggle();
});

$('.hotel-tab').click(function(){
var hotel_id = $(this).attr('hotel_id');
var content_div = $(this).next('.info-content');
if(content_div.html()==''||1){
$(this).next('.info-content').load('/_ajax/ajax.index.php',{
'hotel_id':hotel_id,
file:'hotel.get.ajax.php'
},function(data){

$(this).slideDown('fast');
var total_count = $(this).find('[name=count]').val();
var current_pic = 1;
$(this).find('.big-image div').click(function(){
var get_pic = current_pic;
if($(this).is('right-arr')){
if(current_pic < total_count){
get_pic++;
}else{
get_pic = 1;
}}else{
if(current_pic > 1){
get_pic--;
}else{
current_pic = total_count;
}}
});
});
}else{
content_div.slideToggle('fast');
}});
});
var current_pic = 1;
$(document).ready(function(){
$('.hotel-gallery .thumbs img').live('click',function(){
go_to_pic($(this).attr('index'));
});

$('.hotel-gallery .right-arr,.left-arr').live('click',function(){
var offset = 1;
if($(this).is('.right-arr')){
offset = -1;
}
var total_pics = $('.hotel-gallery .thumbs img').size();
var go_to = parseInt(current_pic);
go_to = go_to + offset;

if(go_to > total_pics){
go_to = 1;
}else if(go_to < 1){
go_to = total_pics;
}
go_to_pic(go_to);
});
});
function go_to_pic(index){
src = $('.hotel-gallery [index=' + index +']').attr('big_src');
title = $('.hotel-gallery [index= ' + index +']').attr('title');
$('.hotel-gallery .big-image img').attr('src',src).attr('title',title).attr('alt',title);
current_pic = index;
}