if(top.location!=self.location)top.location=self.location.href;
;(function($, window) {
	/** Settings **/

	// List of background images to use, the default image will be the first one in the list
	var backgrounds = [
	    'themes/Cigdem_Abla/images/backgrounds/1.jpg',
		'themes/Cigdem_Abla/images/backgrounds/2.jpg',
		'themes/Cigdem_Abla/images/backgrounds/3.jpg',
		'themes/Cigdem_Abla/images/backgrounds/4.jpg',
		'themes/Cigdem_Abla/images/backgrounds/5.jpg',
		'themes/Cigdem_Abla/images/backgrounds/6.jpg',
		'themes/Cigdem_Abla/images/backgrounds/7.jpg'
	],
	
	// Background options - see documentation
	backgroundOptions = {
			
	},
	
	// Twitter username
	twitterUsername = 'CigdemAblaKresi',
		
	// Number tweets to show, set to 0 to disable Twitter
	tweetCount = 2,	
	
	// The hide map text on the contact page
	hideMapButtonText = 'Hide map';
	
	/** End settings **/
	
	$('html').addClass('js-enabled');
		
	$(document).ready(function() {
		// Preview options
		$('#options-panel').tabSlideOut({
			tabHandle: '.options-handle',                              //class of the element that will be your tab
            tabLocation: 'right',                               //side of screen where tab lives, top, right, bottom, or left
            speed: 300,                                        //speed of animation
            action: 'click',                                   //options: 'click' or 'hover', action to trigger animation
            topPos: '200px',                                   //position from the top
            fixedPosition: false
		});
		
		$('#options-bg').change(function() {
			$('#img-overlay-effects')[0].className = $(this).val();
		});
		
		$('#options-header').change(function() {
			$('#header-outer').removeClass('header-plain header-diagonal header-middle header-dark').addClass($(this).val());
		});
		
		$('#options-content-bg').change(function() {
			if ($(this).val().length) {
				var removeClasses = 'textured-bg diagonal-bg transparent-bg level1 level2 level3 level4 level5 level6';
				$('.left-col-wrap-inner, .right-col-wrap-inner, .full-width').removeClass(removeClasses).addClass($(this).val());				
			}
		});
		
		$('#options-font').change(function() {
			$('h1, h2, h3, table.pearl-table th').css('font-family', $(this).val());
		});
		// End preview options		
		
		$.fullscreen(
			$.extend(backgroundOptions, {
				backgrounds: window.backgrounds || backgrounds,
				backgroundIndex: window.backgroundIndex				
			})
		);

		// Initialise the menu
		$('ul.sf-menu').superfish({ speed: 0 });
		
		// Tabs (fade effect)
		$('#tabs').tabs({
			fx: {
				opacity: 'toggle'
			}
		});
		
		// Accordion
		$('#accordion').accordion({
			autoHeight: false
		});
		
		// Testimonials
		if ($('#testimonials').length) {
			$('#testimonials').cycle({
				fx: 'fade',
				timeout: 6000,
				cleartype: true, cleartypeNoBg: true
			});
		}
				
		// Footer pop out boxes
		$('.footer-pop-out-trigger', '#footer').click(function () {
			var $trigger = $(this);
			var $allBoxes = $('.footer-pop-out-box', '#footer');
			if ($allBoxes.is(':animated')) {
				return false;
			}
			
			var thisId = $trigger.attr('id').substring(16);
			var $thisBox = $('#' + thisId + '-pop-out');
			if ($thisBox.is(':visible')) {
				$('.footer-pop-out-trigger').removeClass('footer-pop-active');
				$thisBox.slideUp();
			} else {
				if ($allBoxes.is(':visible')) {
					$('.footer-pop-out-trigger').removeClass('footer-pop-active');
					$allBoxes.filter(':visible').slideUp(function() {
						$trigger.addClass('footer-pop-active');
						$thisBox.slideDown();
					});
				} else {
					$trigger.addClass('footer-pop-active');
					$thisBox.slideDown();
				}
			}
			
			return false;
		});		
		
		// Bind the view map button to slide down / up the map
		var $viewMapButton = $('.view-map'),
		$mapImg = $('.hidden-map'),
		$contactInfoWrap = $('.iphorm-outer'),
		viewMapButtonText = $('.view-map').text();
		
		$viewMapButton.click(function() {
			if (!$mapImg.add($contactInfoWrap).is(':animated')) {
				if (!$mapImg.hasClass('map-visible')) {
					$contactInfoWrap.slideUp(600, function() {
						$mapImg.slideDown(600, function() {
							$mapImg.addClass('map-visible');
							$viewMapButton.text(hideMapButtonText);
						});
					});
				} else {
					$mapImg.removeClass('map-visible').slideUp(600, function() {
						$contactInfoWrap.slideDown(600, function() {
							$viewMapButton.text(viewMapButtonText);
						});
					});
				}
			}
			return false;
		});
		
		// Bind any links with the class 'scroll-top' to animate the scroll to the top
		var scrollElement = 'html, body';
		$('html, body').each(function () {
			var seDomElement = $(this)[0];
		    var initScrollTop = seDomElement.scrollTop;
		    
		    seDomElement.scrollTop = initScrollTop + 1;
		    if (seDomElement.scrollTop == initScrollTop + 1) {
		        scrollElement = this.nodeName.toLowerCase();
		        seDomElement.scrollTop = initScrollTop;
		        return false;
		    }    
		});
		
		$('a.scroll-top').click(function () {			
			if ($(scrollElement).scrollTop() > 0) {
				$(scrollElement).animate({ scrollTop: 0 }, 1000);
			}			
			return false;
		});
		
		// Click "Post a comment" button scrolls to comment form
		$('.post-a-comment-link a').click(function () {
			if ($('#comment_form').length) {
				var offsetTop = $('#comment_form').offset().top;
				$(scrollElement).animate({ scrollTop: offsetTop-25 }, 1000);
				
				return false;
			}
		});
		
		// Open links with class popup-link in new window
		$('a.popup-link').click(function() {
			var href = $(this).attr('href');
			if (href.length > 0) {
				window.open(href);
			}
			return false;
		});

		// Make the form inputs and search fields clear value when focused
		$('.toggle-val').toggleVal({ populateFrom: 'label', removeLabels: true });

		// Create the gallery rollover effect
		$('li.one-portfolio-item a').append(
			$('<div class="portfolio-hover"></div>').css({ opacity: 0, display: 'block' })
		).live('mouseenter', function() {
			$(this).find('.portfolio-hover').stop().fadeTo(400, 0.8);
		}).live('mouseleave', function() {
			$(this).find('.portfolio-hover').stop().fadeTo(400, 0.0);
		});				
	}); // End (document).ready
	
	$(window).load(function() {
		// Load the Twitter feed
		if (twitterUsername && tweetCount > 0) {
			(function() {
				var t = document.createElement('script'); t.type = 'text/javascript'; t.src = 'http://twitter.com/statuses/user_timeline/' + twitterUsername + '.json?callback=twitterCallback2&count=' + tweetCount;
				var h = document.getElementsByTagName('head')[0]; h.appendChild(t);
			})();
		}
		
		if ($('ul#homepage-slider').length) {
			// Anything slider
			$('.homepage-slider-loading').remove();
			$('ul#homepage-slider').show().anythingSlider({
				width: 900,
				height: 300,
				resizeContents: false,
				delay: 6000,
				startStopped: true
			});
		}
	}); // End (window).load	

	// Any images to preload
	window.preload([
        'images/nav-a-bg1.png',
 		'images/go-to-top1.png',
 		'images/minimise1.png',
		'images/sub-a-hover.png',
		'images/sub-a-hover-warrow.png',
 		'images/2-col-hover.png',
 		'images/3-col-hover.png',
 		'images/4-col-hover.png',
 		'images/5-col-hover.png',
 		'images/6-col-hover.png',
 		'images/grid-hover.png',
		'images/pop-up-h2-bg.png',
		'images/pop-up-rep.png',
		'images/opacity-60-rep.png',
 		'images/opacity-80-rep.png',
 		'images/horz-content-nav-bg2.png',
 		'images/go-to-top1.png',
 		'images/vert-nav-bg.png',
		'images/sub-a-hover-warrow.png',
		'images/sub-a-hover.png',
		'images/twitter-button-bg2.png'
 		
	]);
})(jQuery, window);
