var tempsrc;
var tempsrc2;

$(document).ready(function() {

	$('a#home').click(function(e) {
                e.preventDefault();
                $('body,html').stop().animate({'scrollTop':0},1500);
        });

	$('a#portfolio').click(function(e) {
		e.preventDefault();
		$('body,html').stop().animate({'scrollTop':'1800px'},1500);
	});

	$('a#clients').click(function(e) {
                e.preventDefault();
                $('body,html').stop().animate({'scrollTop':'3600px'},1500);
        });

	$('a#testimonials').click(function(e) {
                e.preventDefault();
                $('body,html').stop().animate({'scrollTop':'5400px'},1500);
        });

	$('a#awards').click(function(e) {
                e.preventDefault();
                $('body,html').stop().animate({'scrollTop':'7200px'},1500);
        });

	$('a#whois').click(function(e) {
                e.preventDefault();
                $('body,html').stop().animate({'scrollTop':'9000px'},1500);
        });

	$('a#contact').click(function(e) {
                e.preventDefault();
                $('body,html').stop().animate({'scrollTop':'10800px'},1500);
        });

	$('a#press').click(function(e) {
		e.preventDefault();
		$('body,html').stop().animate({'scrollTop':'12600px'},1500);
	});

	$('#restoflogo a.menuopt').mouseover(function() {
		tempsrc = $(this).children('img').attr('src');
		tempsrc2 = tempsrc;
		tempsrc2 = tempsrc.slice(0, -4);
		tempsrc2 += '2.png';
		$(this).children('img').attr({'src':tempsrc2});
	})
		.mouseout(function() {
			$(this).children('img').attr({'src':tempsrc});	
	});

	$('#container_testimonials #popupInner').tinyscrollbar();
	$('#container_portfolio #popupInner2').tinyscrollbar();
	$('a.noiframe').fancybox();
        $('a.iframe').fancybox({
		'width' : '75%',
	        'height' : '75%',
                'type' : 'iframe'
        });


	$('.sortbtn').click(function(e) {
		e.preventDefault();
		var target = $(this);
		var type = e.target.id;
		$('a.selected').removeClass('selected');
		target.addClass('selected');
		$('#container_portfolio #scrollMe').html('Loading selected work...');
		$.post('getport.php?portfolio=' + type + '', function(data) {
			$('#container_portfolio #scrollMe').html(data);
			$('#container_portfolio #popupInner2').tinyscrollbar();			
			$('a.noiframe').fancybox();
			$('a.iframe').fancybox({
				'width' : '75%',
				'height' : '75%',
				'type' : 'iframe' 
			});
		});	
	});

	$('#page-links a').click(function(e) {
		e.preventDefault();
		var target = $(this);
		var pageno = e.target.id;
		$.post('getclients.php?page=' + pageno + '', function(data) {
			$('#container_clients div.entry').html(data);
		});
	});

});

