
/**
 * Cookie plugin 1.0
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};
;
(function ($) {
$(document).ready(function(e) {
 $('.homeshoplink, .homemaglink, .homebloglink, .celebritystyle, .newstipstrends, .emergingfashion, .ratemystyle, .streetstyle, .guestblog, #hp_newsletter, #hp_fb, #hp_twitter, #hp_signup')
    .append('<span class="hover"></span>').each(function () {
	  var $span = $('> span.hover', this).css('opacity', 0);
	  $(this).hover(function () {
	    $span.stop().fadeTo(500, 1);
	  }, function () {
	    $span.stop().fadeTo(500, 0);
	  });
	});
	});
	
// anchor link start here 


$(function() {
		function filterPath(string) {
			return string
			.replace(/^\//,'')
			.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
			.replace(/\/$/,'');
		}
		var locationPath = filterPath(location.pathname);
		var scrollElem = scrollableElement('html', 'body');
		$('a[href*=#]').each(function() {
			var thisPath = filterPath(this.pathname) || locationPath;
			if (  locationPath == thisPath
				&& (location.hostname == this.hostname || !this.hostname)
				&& this.hash.replace(/#/,'') ) {
					var $target = $(this.hash), target = this.hash;
					if (target) {
						var targetOffset = $target.offset().top;
						$(this).click(function(event) {
							event.preventDefault();
							$(scrollElem).animate({scrollTop: targetOffset}, 400, function() {
								location.hash = target;
							});
						});
					}
			}
		});
		function scrollableElement(els) {
			for (var i = 0, argLength = arguments.length; i <argLength; i++) {
				var el = arguments[i],
				$scrollElement = $(el);
				if ($scrollElement.scrollTop()> 0) {
					return el;
				} else {
					$scrollElement.scrollTop(1);
					var isScrollable = $scrollElement.scrollTop()> 0;
					$scrollElement.scrollTop(0);
					if (isScrollable) {
						return el;
					}
				}
			}
			return [];
		}
	});
// image pop pup start here 

jQuery.fn.center = function () {
		this.css("position","absolute");
		this.css("top", ( $(window).height() - this.height() ) / $(window).scrollTop() + "px");
		this.css("left", ( $(window).width() - this.width() ) / $(window).scrollLeft() + "px");
		return this;
	}

	$(function() {		
		$("#pressimage img").click(function(e){
		
			$("#pressimageback").css({"opacity" : "0.7"})
							.fadeIn("slow");			
						
			$("#pressimagelargeversion").html("<img src='"+$(this).parent().attr("href")+"' alt='"+$(this).attr("alt")+"' /><br/>"+$(this).attr("rel")+"")
					   .center()
					   .fadeIn("slow");			
			
			return false;
		});
			
		$(document).keypress(function(e){
			if(e.keyCode==27){
				$("#pressimageback").fadeOut("slow");
				$("#pressimagelargeversion").fadeOut("slow");
			}
		});
		
		$("#pressimageback").click(function(){
			$("#pressimageback").fadeOut("slow");
			$("#pressimagelargeversion").fadeOut("slow");
		});
		
		$("#pressimagelargeversion").click(function(){
			$("#pressimageback").fadeOut("slow");
			$("#pressimagelargeversion").fadeOut("slow");
		});
		
	});
	
})(jQuery);;

