function effects_init () {
	$('tr:even').addClass('even'); $('tr:odd').addClass('odd');
	$('.SelectPublicItem li:even').addClass('even'); $('.SelectPublicItem > li:odd').addClass('odd');
	//~ $('.details').append('<tfoot style="background:url(./img/wind_canada_details_bottom.png)  no-repeat top left;"><tr><td colspan=2 style="height:31px">&nbsp;</td></tr></tfoot>')
	$('#GroupItemsDiv li:odd').addClass('odd');
	$("#MainDetailsData td:nth-child(1)").addClass('first_td');

	if (self.Nifty)   {
		Nifty("div.menu_item h2","transparent");
		Nifty("div.inner_menu_item","transparent");
		Nifty("div.login_desc","transparent big");
		Nifty("div.signin_box","transparent big");
		Nifty("div.button","transparent small");
		Nifty("div.Button a","transparent small");
		Nifty("div.round_corner_small","transparent small");
		Nifty("div.round_corner","transparent");
		if (navigator.userAgent.indexOf('MSIE 7') < 0) {
			Nifty("div.round_corner_big","transparent big");
			Nifty("div.content","transparent big");
		}
		//~ Nifty("div#drop_down_select","transparent small");
		//~ Nifty("div.signin_input","transparent small");
	}

	if (self.Cufon) {
		Cufon.replace('h1', {fontFamily: 'Gotham Rounded Medium'});
		Cufon.replace('h2', {fontFamily: 'Gotham Rounded Medium'});
		Cufon.replace('legend', {fontFamily: 'Gotham Rounded Medium'});
		Cufon.replace('#drop_down_select', {fontFamily: 'Gotham Rounded Book'});
		Cufon.replace('#drop_down_options', {fontFamily: 'Gotham Rounded Book'});
		Cufon.replace('.cufonize', {fontFamily: 'Gotham Rounded Book'});
		Cufon.replace('#MainDetailsData caption', {fontFamily: 'Gotham Rounded Book'});
		Cufon.replace('#contacts_mainbar a', {fontFamily: 'Gotham Rounded Book'});
		Cufon.replace('#WebEdit a', {fontFamily: 'Gotham Rounded Book'});
		Cufon.replace('#contacts_merge_menu a', {fontFamily: 'Gotham Rounded Book'});
		Cufon.replace('#restore_action_form span', {fontFamily: 'Gotham Rounded Book'});
		//~ Cufon.replace('#edit_box label', {fontFamily: 'Gotham Rounded Book'});
		//~ Cufon.replace('#GeneralListUl a', {fontFamily: 'Gotham Rounded Book'});
		//~ Cufon.replace('#MainDetailsData td', {fontFamily: 'Gotham Rounded Book'});
		//~ Cufon.replace('#GroupItemsDiv label', {fontFamily: 'Gotham Rounded Book'});
		//~ Cufon.replace('#GeneralList option', {fontFamily: 'Gotham Rounded Book'});
	}

}

function hide_signin_info() {
	document.getElementById('signin_password_overlay').style.display='none';
	if (document.getElementById('username').value == 'email address') document.getElementById('username').value='';
}


$(function() {
	$('.menu_item p').hide();
	$('.menu_item1 h2 a')
		.mouseover( function () {
			$(this).parent().next('p').show();
		})
		.mouseout( function () {
			$(this).parent().next('p').hide();
		});
});

$(document).ready(function(){
	if (document.getElementById('drop_down_options') != null) handle_drop_down();
	if (document.getElementById('import_csv') != null) adjust_csv_importer_height();
});

function adjust_csv_importer_height() {
	var h = $("#import_progress").css('height').replace('px','');
	if (h != 'auto') {
		$("#csv_importer_container").css('height',(parseInt(h)+ 50).toString()+'px');
	} else {
		var str = '';c=0;
		var elem = document.getElementById('import_csv').elements;
		for(var i = 0; i < elem.length; i++) {
			if (elem[i].name.indexOf('fields') > -1) c++;
		}
		h = (parseInt(c) * 20 + 350).toString()+'px';
		$("#csv_importer_container").css('height',h);
	}
}

function handle_drop_down() {
	$("#drop_down_options").css('display','none');

	$("#down_arrow img").click(function(event){
		//~ $("#drop_down_options").toggle(); // Not working for IE8 !
		if ($("#drop_down_options").css('display') == 'none') {
			$("#drop_down_options").css('display','block');
		} else {
			$("#drop_down_options").css('display','none');
		}
		return false;
	});

	var drop_down_options_li_bg = $("#drop_down_options li").css('background-color');
	$("#drop_down_options li").mouseenter(function(event){ $(this).css('background-color','#D7D3C7');});
	$("#drop_down_options li").mouseleave(function(event){ $(this).css('background-color',drop_down_options_li_bg); });

	$(document).click(function(event){ $("#drop_down_options").css('display','none'); });
	$("#drop_down_options").click(function(event){return false});	//This is to prevent hiding the drop_down_options when clicked on because of $(document).click function

	$("#drop_down_options li").click(function(event){
		$("#selected_option").attr('value',$(this).attr('id'));
		$("#drop_down_select_div form:first").submit();
	});

	$("#drop_down_options a").click(function(event){
		var href = $(this).attr('href');
		var start = href.indexOf('selected_option=')+length('selected_option=');
		var end = href.indexOf('&',start);
		if (end == -1) { end = length(href); }
		$("#selected_option").attr('value',href.substring(start,end));
		$("#drop_down_select_div form:first").submit();
		return false;
	});
}

