	$(document).ready(function() {
		$( ".sortcolumn" ).sortable({
			connectWith: ".sortcolumn",
			handle: 'div.portlet-header'
		});

		$( ".portlet" ).addClass( "" )
			.find( ".portlet-header" )
				.prepend( "<span class='c-icon icon-minus'></span>")
				.end()
			.find( ".portlet-content" );

		$( ".portlet-header .c-icon" ).click(function()
		{
			$( this ).toggleClass( "icon-minus" ).toggleClass( "icon-plus" );
			$( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle();
		});

		$( ".sortcolumn" ).enableSelection();

  		$('.switcher').hide();

        $("#ourSites").click(function () {
	          $(".switcher").fadeIn(400, function ()
	          {

	          });
          return false;
        });

        $("#close_switcher").click(function () {
	          $(".switcher").fadeOut(400, function ()
	          {

	          });
          return false;
        });

		var box = $('.switcher');
		$(document.body).click(function(){
		    if (!box.has(this).length) {
		        box.fadeOut(400);
		    }
		});



	$('#contactform').submit(function(){
		var action = $(this).attr('action');
		$.post(action, {
			name: $('#name').val(),
			email: $('#email').val(),
			mobile: $('#mobile').val(),
			subject: $('#subject').val(),
			message: $('#message').val()
		},
			function(data){
				$('#contactform #submit').attr('disabled','');
				$('.response').remove();
				$('#contactform').before('<p class="response">'+data+'</p>');
				$('.response').slideDown();
				if(data=='تلقينا رسالتكم بنجاح نعدكم أن يتم الرد عليكم بأسرع وقت') $('#contactform').slideUp();
			}
		);
		return false;
	});





	});




	function setType(type)
	{		var type;
        var typeId = type+'site';

        $('#allsite').removeClass('selected');
        $('#devsite').removeClass('selected');
        $('#dessite').removeClass('selected');
        $('#natsite').removeClass('selected');
        $('#heyasite').removeClass('selected');

		$('#'+typeId).addClass('selected');

		$('#type').val(type);
	}

	function DataCheck()
	{
		var queryVal = $('#query').val();  		if(queryVal == '' || queryVal == 'أدخل ماتريد البحث عنه')
  		{
  			message3QL('من فضلك أدخل ماتريد البحث عنه','خطأ بالبحث');
  			return false;
  		}
  		else
  		{  			return true;

  		}

	}


	function message3QL (message,title)
	{
  		var message;
  		var title;
        $('#dialog-modal').show();

    	$('#dialog-modal').attr('title', title);
    	$('#dialog-modal').html('<br /><br /><p>'+ message +'</p>');

		$( "#dialog:ui-dialog" ).dialog( "destroy" );

		$( "#dialog-modal" ).dialog
		({
			height: 100,
			modal: true
		});

	}
