

var activeInstructionStep = 0;

$(document).ready(function() {


	//products page - fade out/in INSTRUCTIONS left
	
    if ( jQuery().fancybox && document.getElementById('instructions') ) {
    	instructionsFade();
    	$('#instructions > p').addClass('instructions_c1');
    	setInterval ( "instructionsFade()", 1500 );    	    	
    }
   
    
});

function instructionsFade() {
	$('#instructions > p').removeClass('instructions_c2'); 
	$('#instructions > p').addClass('instructions_c1');
	
	activeInstructionStep++;
	if ( activeInstructionStep > 3 ) {
		activeInstructionStep = 1;
	}
	
	$('#instructions > p.step' + activeInstructionStep).addClass('instructions_c2');
} 


	
	
/****************************************************************************/	




	
	
$(document).ready(function() {
	
	var triggerHandleOnMouseOutCompanyCategories = true;

    if (jQuery().fancybox) {							
	    
    	$('a.products2').fancybox({
    		'width'				: 670,
    		'height'			: '70%',
            'autoDimensions'    : false,
    		'type'				: 'ajax',
            'onStart'		    : function() {
            	    triggerHandleOnMouseOutCompanyCategories = false;
            },
            'onClosed'		    : function() {
            	    triggerHandleOnMouseOutCompanyCategories = true;
            }

	   });
	

      $('#container_logos_products').mouseleave(function() {
          if ( triggerHandleOnMouseOutCompanyCategories == true )
          {
            restoreCompanyCategories();
          }
      });
	   
    }
/*   
    if (jQuery().serialScroll) {    
        $('#news2').serialScroll({
    		items:'div',
    		cycle: true,
    		duration:1000,
    		force:true,
    		axis:'x',
    		easing:'swing',
    		lazy:false,// NOTE: it's set to true, meaning you can add/remove/reorder items and the changes are taken into account.
    		interval:5000, // yeah! I now added auto-scrolling
    		step:1 // scroll x news each time
	});	
    }	    
*/	
});


function showCompanyCategories(company_code)
{
    $('div.categories_company_container').hide();
    $('#products_company_' + company_code).fadeIn('fast');
    $('img.logos_img_hover').removeClass('logos_img_hover');
    $('#img_company_logo_' + company_code).addClass('logos_img_hover');
}

function restoreCompanyCategories()
{
    $('div.categories_company_container').hide();
    $('img.logos_img_hover').removeClass('logos_img_hover');
    $('#products_company_INACTIVE').show('fast');

}


function validate_contact()
{
    //lang
    if ( document.form_contact.lang.value == 'el' ) {
        var JS_LANG_FILL_ALL_FIELDS = 'Παρακαλώ συμπληρώστε όλα τα απαραίτητα πεδία.';
        var JS_LANG_INVALID_EMAIL = 'Μη έγυρη τιμή για το πεδίο "EMAIL". Παρακαλώ διορθώστε.';        
    }
    if ( document.form_contact.lang.value == 'en' ) {
        var JS_LANG_FILL_ALL_FIELDS = 'Please fill in all the required fields.';
        var JS_LANG_INVALID_EMAIL = 'Invalid Email address. Please re-enter.';            
    }    
    
    //required    
    if ( $('#f1').val() == '' || $('#f2').val() == '' || $('#f4').val() == '' || $('#f6').val() == '' ) {
        alert(JS_LANG_FILL_ALL_FIELDS);
        return;
    }
    
   
    //check email
    var test_pattern = /[\w-]+@([\w-]+\.)+[\w-]+/;
	if ( !test_pattern.test( $('#f6').val() ) ) {
		alert(JS_LANG_INVALID_EMAIL);
		return;
	}
	
               
    
    
    
    document.form_contact.submit();

}


