// JavaScript Document

$(document).ready(function(){
	$(".right-menu-listed-items").each(function(){
		$(this).find("li:last").css("background", "none");
	});
	$(".listed-right-with-icon").each(function(){
		$(this).find("li:last div.grey-bordered").css("background", "none");
	});
	$('.tabs-nav li:first').css("margin-left", 1);
/*	$(".cit-table tr").each(function(){
		$(this).find("td:last").addClass('bottom-align');
	});
*/
	$(".we-holder tr").each(function(){
		$(this).find('td:last img').css('margin-right', 0);
	});
/*	$('.couv-acc-holder li:last').css('margin-right', 0);
	$('.we-item-img').each(function(){
		$(this).parent().find('div.width230').css('display', 'none');
	});

*/	$('.couv-acc-holder').each(function(){
		$(this).find('li:eq(3)').css('margin-right', 0);
		$(this).find('li:eq(7)').css('margin-right', 0);
		$(this).find('li:eq(11)').css('margin-right', 0);
		$(this).find('li:eq(15)').css('margin-right', 0);
		$(this).find('li:eq(19)').css('margin-right', 0);
		$(this).find('li:eq(23)').css('margin-right', 0);
	});
	
	
	
	
	$('.we-item-img').each(function(){
		$(this).hover(
		function(){
			$(this).parent().find('div.width230').css('display', 'block');
		},
		function() {
			$(this).parent().find('div.width230').css('display', 'none');
		});
	});
	
	
	
	
	
	$('.we-small-listing').each(function(){
		$(this).hover(
		function(){
			$(this).parent().find('div.width68').css('display', 'block');
		},
		function() {
			$(this).parent().find('div.width68').css('display', 'none');
		});
	});
	/*$('.show-div a').click(function(){
		$(this).parent().parent().parent().find('div.hidden-div').slideToggle('slow');
	});*/
});
/*******************************************tabs****************************************/
function ValidateOtherSearch(source, args) {
    if (MM_findObj("ctl00_ControlHeader1_txtSearch") != null) {
        if (MM_findObj("ctl00_ControlHeader1_txtSearch").value.length < 3 || MM_findObj("ctl00_ControlHeader1_txtSearch").value == "Enter keyword...")
            args.IsValid = false;
        else
            args.IsValid = true;
    }
    else {
        if (MM_findObj("ControlHeader1_txtSearch").value.length < 3 || MM_findObj("ControlHeader1_txtSearch").value == "Enter keyword...")
            args.IsValid = false;
        else
            args.IsValid = true;
    }
}

function MM_findObj(n, d) {
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}
/*****************************************************************/
    $('.photogal-acc-holder').each(function() {
        $(this).find('li:eq(4)').css('margin-right', 0);
        $(this).find('li:eq(8)').css('margin-right', 0);
    });

    function gototop() {
        $('#anchor1').click()

    }
    function gototop2() {
        $('#anchor2').click();
    }
    function gototop3() {
        $('#anchor3').click();
    }
/*----------------------------------------------------print----------------------------------------*/
function print_function(pagetitle){ 
	//alert('Coming Soon');
	var disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
	disp_setting+="scrollbars=yes,width=700, height=500, left=100, top=100";
	var content_title = document.getElementById(pagetitle);
	var content_value = document.getElementById("body-content").innerHTML;
	var docprint=window.open("","",disp_setting);
	docprint.document.open();
	docprint.document.write('<html><head><title>Agenda Culturel</title>');
	docprint.document.write('<link rel="stylesheet" type="text/css" href="styles/ac.css" media="screen print" /><link rel="stylesheet" type="text/css" href="styles/ac.css"><link rel="stylesheet" href="styles/selectbox.css" type="text/css" /><link rel="stylesheet" href="styles/tabs.css" type="text/css" /><link href="styles/online.css" rel="stylesheet" type="text/css" /><link href="styles/print.css" rel="stylesheet" type="text/css" /></head><body onLoad="">');
	docprint.document.write('<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td style="vertical-align:middle;"><table cellpadding="0" cellspacing="0" width="100%"><tr><td><div style="margin-left:20px; margin-top:10px;"><img src="images/logo-print.gif" /></div><div style="margin-top:10px; font-size:11px; margin-left:20px;">www.agendaculturel.com</div></td><td style="vertical-align:middle" class="date" width="150">' + d_names[curr_day] + " " + curr_date + " " + m_names[curr_month] + " " + curr_year +'<br /><br /><a onClick="javascript:self.print(); self.close();" class="print-button">Print</a></td></tr></table></td></tr><tr><td style="padding:10px;">'+ pagetitle +'</td></tr><tr><td style="padding:10px;" class="main-image-holder body-content">'+content_value+'</td></tr></table>');
	docprint.document.write('</body></html>');
	docprint.document.close(); 
 	docprint.focus();
}
/*-----------------------tooltip-----------------------------*/
/*$(document).ready(function(){
	$('a.tooltip').hover(function(){
		$(this).parent().find('div.div-tooltip').addClass('shown-div')
	},
	function(){
		setTimeout(function(){$('div.shown-div').removeClass('shown-div')}, 2000);
		//setTimeout(function(){ $(".notice").fadeOut() }, 5000);

	});
});*/
function ClearFieldMsg(Field, Msg) {
    if (Field.value == Msg)
        Field.value = "";
}
function AddFieldMsg(Field, Msg) {
    if (Field.value == '')
        Field.value = Msg;
}
/*****************************************************/
var max_font_size = 18;
var min_font_size = 10;

$(function(){
	$('.controls a').click(function(){
		var ourText = $('#body-content, #body-content div, #body-content td, #body-content td div, .body-content, .body-content div, .body-content td, .body-content td div')/*.not(".more a")*/;
		var currFontSize = ourText.css('fontSize');
		var finalNum = parseFloat(currFontSize, 12);
		var stringEnding = currFontSize.slice(-2);
		if(this.id == 'large') {
			if(finalNum < max_font_size) finalNum += 2;
		}
		else if (this.id == 'small'){
			if(finalNum > min_font_size) finalNum -=2;
		}
		ourText.css('fontSize', finalNum + stringEnding);
	});
});

function toggleMoreClass(){
	$(this).toggleClass('test');
	}



