/*********************
//* jQuery Multi Level CSS Menu #2- By Dynamic Drive: http://www.dynamicdrive.com/
//* Created: Nov 2nd, 08'
//* Menu avaiable at DD CSS Library: http://www.dynamicdrive.com/style/
*********************/

$(document).ready(function(){    $("#sendButton").click(function(){
    	var firstName = $("#fname").val();
    	var email = $("#email").val();
    	var phone = $("#phone").val();
    	var coment = $("#coment").val();    	//var emailWay = $(".emailWay:checked").val();
    	var errors = 0;

    	if(firstName == "")
    	{    		//$("#fname").css("border","solid 1px #FF0030");
    		errors ++;
    	}
    	else
    	{    		//$("#fname").css("border","solid 1px #CCCCCC");
    	}
    	if(email == "")
    	{    		//$("#email").css("border","solid 1px #FF0030");
    		errors ++;
    	}
    	else
    	{    		//$("#email").css("border","solid 1px #CCCCCC");
    	}

    	if(phone == "")
    	{    		//$("#phone").css("border","solid 1px #FF0030");
    		errors ++;
    	}
    	else
    	{    		//$("#phone").css("border","solid 1px #CCCCCC");
    	}

    	if(errors > 0)
    	{
    	}
    	else
    	{
    		 JsHttpRequest.query(
		     "skin/php/writeUser.php",
		     {
		     	 "firstName": firstName,
		    	 "email": email,
		    	 "phone": phone,
		    	 "coment": coment
		     },
			   function (result,errors)
			   {
				   if (result)
				   {
				   		var ok = result.ok;
				   		if(ok == "ok")
				   		{				   			$("#formID").hide();
				   			$("#successText").show();
				   		}
				   		else
				   		{
				   		}
				   }
				   else
				   {

				   }
		   	   },
			   true
			)
    	}
    });


    $(".filialMenu").hover(function(){
    	$(this).parent().parent().css("background-color","#000000");
    },
    function(){
        $(this).parent().parent().css("background-color","");
    });

    $(".filialMainDIV").hover(function(){
    	$(this).css("background-color","#000000");
    },
    function(){
        $(this).css("background-color","");
    });

    /*SHOW / HIDE news / artices / company news*/
    $(".showNewsLink").toggle(function(){    	var linkID = $(this).attr("linkID");
    	$(".newsDVcl[linkID="+linkID+"]").slideDown("slow");
    },
    function(){        var linkID = $(this).attr("linkID");
    	$(".newsDVcl[linkID="+linkID+"]").slideUp("slow");
    });
    /*END*/

	$(".noLinkIs").click(function(){		return false;
	});

	$(".topLogoLinkCL").click(function(){		$.cookie("menuID",null);
   		$(".hidSubMenuNew").slideUp("fast");
	});

	/*GRAPHICS LINKS*/
	$(".graphLinksL").hover(function(){
	   $(".graphDV").stopTime('timer3');
       //$(".graphDV").hide();
       $(".graphDV").fadeTo(500,0.5);
       var idGraph = $(this).attr("idGraph");
       $(".graphIndic").show();

       $(".graphDV").everyTime(300,'timer3', function(i){
       		if(i == 2)
       		{
       			$(".graphDV").fadeTo(1,1);
       			$(".graphDV").hide();
       			$(".graphIndic").hide();
       			$(".graphDV[idGraph="+idGraph+"]").show();
       		}
       		else
       		{
       		}
       });
	},
	function(){
		$(".graphIndic").hide();        $(".graphDV").stopTime('timer3');
        $(".graphDV").fadeTo(1,1);
	});
	/*END*/
});