
jQuery.noConflict(); 

jQuery(document).ready(

				   function(){
					   
					   jQuery("#s").focus(function(){
  //alert('aa');
						  jQuery("input#s").val("");
  													});
  					
					   
						 jQuery('#vote_submit').click(function()
											   {
 												 
												var voteindex=jQuery("input#voteindex").val();
                                                  
													  var votevalue=jQuery("input#votevalue").val()
													  
													  //alert(voteindex+":"+votevalue);
													  jQuery("#vote_form").html('loading .....');
												jQuery("#vote_form").load("js/ajavote.php", { 'voteindex': [voteindex],'value': [votevalue]});
												this.hide();											
											   }
											   );					   
					   	jQuery("#Result").click(function () {
var voteindex=jQuery("input#voteindex").val();
	//alert(voteindex);
	    
		jQuery("#vote_form").load("js/ajavote.php?view=res", { 'voteindex': [voteindex]});
		this.hide();
		
	});
					   }
					   
				   );






/* SCSS Books*/

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 2,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
});

/**********************************email*************************************/
 jQuery(document).ready(function() {

            jQuery(".signin").click(function(e) {          
				e.preventDefault();
                jQuery("fieldset#signin_menu").toggle();
				jQuery(".signin").toggleClass("menu-open");
            });
			
			jQuery("fieldset#signin_menu").mouseup(function() {
				return false
			});
			jQuery(document).mouseup(function(e) {
				if(jQuery(e.target).parent("a.signin").length==0) {
					jQuery(".signin").removeClass("menu-open");
					jQuery("fieldset#signin_menu").hide();
				}
			});			




        });
 
 /**************************************ٍSearch click ************************************/
 
jQuery(document).ready(function(){
				   
   

    jQuery('#search').keyup(function(e) {
   
      //alert(e.keyCode);
   
      if(e.keyCode == 13) {
   
      //alert('Enter key was pressed.');
	  jQuery('#frmsearch').submit();
   
      }
	  
   
      });  
	/***************************************News Ticker*********************************/
	jQuery(".newsticker-jcarousellite").jCarouselLite({
		vertical: true,
		hoverPause:true,
		visible: 1,
		auto:500,
		speed:2000
	});
	/*****************************************collpase*********************************/
	
	 jQuery(".message_head .expand").click(function(){
  
    jQuery(this).parents(".message_head").next(".message_body").slideToggle(500)

    if(jQuery(this).attr("class")=="timestamp")
	{
	jQuery(this).removeClass('timestamp')
	jQuery(this).addClass('expand')
	}
	else
	{
	jQuery(this).removeClass('expand')
	jQuery(this).addClass('timestamp')
	}
	
		
		return false;
	});

	/************************mail list*******************************************/

	jQuery("#mlist").click(function(){
						   
						   var name=jQuery("input#name").val();
						   var mail=jQuery("input#mail").val();
						   var scode=jQuery('input#scode').val();
						   var rscode=jQuery('input#rscode').val();
						   
						 if(scode!=rscode)
						   {
							   jQuery('#info').show().html("<font color=red>الرجاء التاكد من إدخال كود التفعيل بشكل الصحيح</font>"); 
							   return false;
						   }
						   
						  var url="lib/mlist.php?action=add";

   						var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
						   if(reg.test(mail) == false) {
      							alert(' الرجاء التاكد من ادخال بريد الاكتروني صحيح');
						   								} else {
															
									 jQuery('#info').show().html("<img src=images/spinner.gif  />");
									jQuery.ajax({
  										 type: "POST",
									      url: url ,
									     data: "mail="+mail+"&name="+name,
									  success: function(msg){
							                     jQuery('#info').show().html(msg);
													   		}
										  		});
														       }
										 				 
						   });//mlist					
jQuery("#unmlist").click(function(){
						   
						    var mail=jQuery("input#mail").val();
						    var url="lib/mlist.php?action=del";
 					    	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
						   if(reg.test(mail) == false) {
      							alert(' الرجاء التاكد من ادخال بريد الاكتروني صحيح');
						      
													   } else {
														   
									 jQuery('#info').show().html("<img src=images/spinner.gif  />");
									jQuery.ajax({
  										 type: "POST",
									      url: url ,
									     data: "mail="+mail,
									  success: function(msg){
							                     jQuery('#info').show().html(msg);
												        		}
										    	});
											}			   
														 
						   });//mlist					

					  }); // ready 

