$(document).ready(function(){
        $("ul.main-nav").superfish(); 
        
        $("#slides")        
        .cycle({
        	fx: 'fade', 
		    speed: 'fast', 
		    timeout: 5000, 
		    pager: '.slider-navigation'
        });
		 
		$("#customers")        
        .cycle({
        	fx: 'fadeZoom', 			
            timeout: 3000,
			random: 1
		   
        });
        
		$('input[type=text]').each(function() {
			var default_value = this.value;
			$(this).focus(function() {
				if(this.value == default_value) {
				this.value = '';
				}
			});
			$(this).blur(function() {
				if(this.value == '') {
				this.value = default_value;
				}
			});
		});
		
		$('input[type=email]').each(function() {
			var default_value = this.value;
			$(this).focus(function() {
				if(this.value == default_value) {
				this.value = '';
				}
			});
			$(this).blur(function() {
				if(this.value == '') {
				this.value = default_value;
				}
			});
		});
		// choose text for the show/hide link - can contain HTML (e.g. an image)
var showText='&#913;&#957;&#945;&#955;&#965;&#964;&#953;&#954;&#942; &#928;&#961;&#959;&#963;&#966;&#959;&#961;&#940; &gt;';
var hideText='&lt; &#923;&#953;&#947;&#972;&#964;&#949;&#961;&#945;';

// initialise the visibility check
var is_visible = false;

// append show/hide links to the element directly preceding the element with a class of "toggle_container"
$('.toggleSection').prev().append(' <a href="#" class="toggleLink">'+showText+'</a>');

// hide all of the elements with a class of 'toggle'
$('.toggleSection').hide();

// capture clicks on the toggle links
$('a.toggleLink').click(function() {

// switch visibility
is_visible = !is_visible;

// change the link depending on whether the element is shown or hidden
$(this).html( (!is_visible) ? showText : hideText);

// toggle the display - uncomment the next line for a basic "accordion" style
//$('.toggle').hide();$('a.toggleLink').html(showText);
$(this).parent().next('.toggleSection').toggle('slow');

// return false so any link destination is not followed
return false;

});


   
   });

/*
addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
opening pdf and external links in new windows
*/
function addEvent( obj, type, fn )
{
	if (obj.addEventListener)
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent)
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

function removeEvent( obj, type, fn )
{
	if (obj.removeEventListener)
		obj.removeEventListener( type, fn, false );
	else if (obj.detachEvent)
	{
		obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
		obj["e"+type+fn] = null;
	}
}


/* Create the new window */
function openInNewWindow(e) {
	var event;
	if (!e) event = window.event;
	else event = e;
	// Abort if a modifier key is pressed
	if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
		return true;
	}
	else {
		// Change "_blank" to something like "newWindow" to load all links in the same new window
	    var newWindow = window.open(this.getAttribute('href'), '_blank');
		if (newWindow) {
			if (newWindow.focus) {
				newWindow.focus();
			}
			return false;
		}
		return true;
	}
}


/*function to hide email links*/
$(document).ready(function() {
    $(".email").each(function() {
        var var_email = $(this).html();
        $(this).load("/my_list.html #"+var_email).append(var_email);
    });
});
