var app = {
		hideWidget: function (id) {
			
			
			//document.getElementById("#like"+id).style.visibility = "hidden";
			clearInterval(app.like_interval);
		},
		like_interval: {}
};

jQuery(document).ready(function(){
	
	
	
	//var hideWidget = {};
	jQuery.noConflict();
	
	jQuery("body").removeAttr('class')
	if(jQuery("body").attr("id")=='kidsbody'){
		jQuery("body").addClass('bg1_girl');
	}
	else{
		jQuery("body").addClass('bg1');
	}
	
	//Click the button event!
	jQuery("#earPiercingVedio").click(function(){
		//centering with css
		positionPopup(100, 200,546,355);
		//load popup
		loadPopup();
	});
				
	//CLOSING POPUP
	//Click the x event!
	jQuery("#popupContactClose").click(function(){
		disablePopup();
	});
	
	jQuery(".wallpaper1").click( function(){ 
			
		//alert(jQuery("body").attr("class"))
		jQuery("body").removeAttr('class')
		if(jQuery("body").attr("id")=='kidsbody'){
			jQuery("body").addClass('bg1_girl');
		}
		else{
			jQuery("body").addClass('bg1');
		}
		
		
	});

	jQuery(".wallpaper2").click( function(){ 
		jQuery("body").removeAttr('class')
		if(jQuery("body").attr("id")=='kidsbody'){
			jQuery("body").addClass('bg2_girl');
		}
		else{
			jQuery("body").addClass('bg2');
		}
	});

	jQuery(".wallpaper3").click( function(){ 
		jQuery("body").removeAttr('class')
		if(jQuery("body").attr("id")=='kidsbody'){
			jQuery("body").addClass('bg3_girl');
		}
		else{
			jQuery("body").addClass('bg3');
		}
	}); 
	
	jQuery(".wallpaper4").click( function(){ 
		jQuery("body").removeAttr('class')
		if(jQuery("body").attr("id")=='kidsbody'){
			jQuery("body").addClass('bg4_girl');
		}
		else{
			jQuery("body").addClass('bg4');
		}
	});

	jQuery(".wallpaper5").click( function(){ 
		jQuery("body").removeAttr('class')
		if(jQuery("body").attr("id")=='kidsbody'){
			jQuery("body").addClass('bg5_girl');
		}
		else{
			jQuery("body").addClass('bg5');
		}
	}); 
	
	jQuery(".wallpaper6").click( function(){
		jQuery("body").removeAttr('class')
		if(jQuery("body").attr("id")=='kidsbody'){
			jQuery("body").addClass('bg6_girl');
		}
		else{
			jQuery("body").addClass('bg6');
		}
	}); 
		
	var allArticleImage = jQuery(".articleImage");
	var c = 0;
	jQuery.each(allArticleImage, function(i, val) {
		jQuery(this).css('position','relative');
		jQuery(this).mouseover(function(){
			item_id = this.id;
			jQuery(this).css('cursor','hand');
			if(jQuery(this).find(".sharewidget").length!=0){
		 		jQuery(".sharewidget").removeAttr("style")
		 		jQuery(".sharewidget >li").removeAttr("style");
		 	}
		  	
		  	jQuery("#like"+this.id).css('position','absolute');

             jQuery("#like"+this.id).css('top',jQuery(this).height()-15);
			jQuery("#like"+this.id).css('width',jQuery(this).width());
			jQuery("#like"+this.id).show();
	
		});
		
		
		jQuery(this).mouseout(function(e) {
			jQuery("#like"+this.id).hide();
			//jQuery("#pannelshare"+this.id).hide();
	    }); 
		
		
	});
	
	
	
	var allpannel = jQuery(".pannel")
	 jQuery.each(allpannel, function(i, val) {
		 jQuery("#"+val.id).hide();
   });
	
	var allshare = jQuery(".share")
	 jQuery.each(allshare, function(i, val) {
		 
		 /*jQuery("#"+val.id).hover(function(){
			
			 if(jQuery("#pannel"+val.id).find(".shareIconList").length!=0){
			 		jQuery(".shareIconList").removeAttr("style")
			 		jQuery(".shareIconList >li").removeAttr("style");
			 	}
			 	if(jQuery(".styleLanding").length!=0){
			 		jQuery("#pannel"+val.id).addClass("box_shadow_light")
			 		jQuery("#pannel"+val.id).css('top',jQuery(this).position().top + jQuery(this).outerHeight());
			 	}else{
			 		jQuery("#pannel"+val.id).css('top',jQuery(this).position().top - jQuery("#pannel"+val.id).outerHeight());
			 	}
			 	jQuery("#pannel"+val.id).css('left',jQuery(this).position().left);
				jQuery("#pannel"+val.id).slideToggle("fast"); 
				jQuery(this).toggleClass("active"); return false;
			});*/
		 
		 jQuery("#"+val.id).click(function(){
			 if(jQuery("#pannel"+val.id).find(".shareIconList").length!=0){
			 		jQuery(".shareIconList").removeAttr("style")
			 		jQuery(".shareIconList >li").removeAttr("style");
			 	}
			 	if(jQuery(".styleLanding").length!=0){
			 		jQuery("#pannel"+val.id).css('top',jQuery(this).position().top + jQuery(this).outerHeight());
			 	}else{
			 		jQuery("#pannel"+val.id).css('top',jQuery(this).position().top - jQuery("#pannel"+val.id).outerHeight());
			 	}
			 	jQuery("#pannel"+val.id).css('left',jQuery(this).position().left);
				jQuery("#pannel"+val.id).slideToggle("fast"); 
				jQuery(this).toggleClass("active"); return false;
			});
		 
		 /*jQuery("#pannel"+val.id).mouseover(function(){
			 //clearInterval(app.like_interval)
			 
		 });*/
		 
		 /*jQuery("#pannel"+val.id).mouseout(function() {
				jQuery("#pannel"+val.id).hide();
				 jQuery(".like").hide()
		    }); */
   });
	
	/*jQuery(document).mouseup(function(e) {
        if(jQuery(e.target).parent("a.share").length==0) {
        	//jQuery(".signin").removeClass("menu-open");
        	jQuery(".pannel").hide();
        }
    }); */
	 
	/*jQuery(".pannel").hide();
	jQuery(".share").hover(function(){
		
		jQuery(".pannel").slideToggle("slow"); 
		jQuery(this).toggleClass("active"); return false;
	});*/
	
	
	
	jQuery('#lista').accordion({
		header: '.header',
			event: 'click',
			autoheight: false,
			alwaysOpen:false,
			active:false
			
		});
	
		
	jQuery(document).ready(function(){
		jQuery("#productsAlbum").treeview({
			
			persist: "location",
			collapsed: true,
			unique: true});
		
		jQuery("#archivedFiles").treeview({
			persist: "location",
			collapsed: true,
			unique: true});
		
		jQuery("#archivedblogs").treeview({
			persist: "location",
			collapsed: true,
			unique: true});
	});
	
	
	jQuery(document).ready(function() {

		jQuery(".signin").hover(function(e) {
	                e.preventDefault();
	                jQuery("fieldset#signin_menu").toggle();
	               // $(".signin").toggleClass("menu-open");
	            });
		jQuery(".signin").click(function(e) {
            e.preventDefault();
            jQuery("fieldset#signin_menu").toggle();
           // $(".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();
	                }
	            });            

	        });
	/******************************
	*   Twitter Feed
	******************************/
	jQuery(document).ready(function(){
		
		facebook();
	});
	
	//Twitter function call => References: /javascript/twitter.js
	jQuery(document).ready(function() {
		jQuery("#twitter").getTwitter({
			userName: "clairesstores",
			numTweets: 1,
			loaderText: "Loading tweets...",
			slideIn: true,
			slideDuration: 750,
			showHeading: true,
			showProfileLink: true,
			showTimestamp: true
		});
		
		
	});
	
	//Input Watermark: Top Search Field => References: watermarkinput.js
    jQuery("#search-box").Watermark("SEARCH");
    jQuery("#firstName").Watermark("FIRST NAME");
    jQuery("#lastName").Watermark("LAST NAME");
    jQuery("#email").Watermark("EMAIL ADDRESS");
    jQuery("#forgotEmailAddress").Watermark("Email address");
    jQuery("#password").Watermark("Password")
    
    jQuery("#day").Watermark("DD");
    jQuery("#month").Watermark("MM");
    jQuery("#year").Watermark("YYYY");
    jQuery("#parentEmail").Watermark("PARENTS EMAIL");
    jQuery("#streetAddress").Watermark("Address 1");
    jQuery("#streetAddress2").Watermark("Address 2");
    jQuery("#street").Watermark("STREET ADDRESS");
    jQuery("#city").Watermark("City");
    jQuery("#state").Watermark("SELECT STATE");
    jQuery("#country").Watermark("SELECT COUNTRY");
    jQuery("#zipcode").Watermark("Zip code");
    jQuery("#secondzipcode").Watermark("ZIP CODE");
    jQuery("#radiusSelect").Watermark("SELECT WITHIN DISTANCE IN MILES");
   jQuery("#registerLoginEmailAddress").Watermark("Email address");
    //jQuery("#registerLoginPassword").Watermark("Password");
    jQuery("#loginEmailAddress").Watermark("Email address");
    jQuery("#loginPassword").Watermark("Password");
    jQuery("#fashionPrefrence1").Watermark("SELECT FASHION PREFRENCE1");
    jQuery("#fashionPrefrence2").Watermark("SELECT FASHION PREFRENCE2");
    jQuery("#fashionPrefrence3").Watermark("SELECT FASHION PREFRENCE3");
    
   /* jQuery("#registerLoginPassword").focus(function(){
    	
    	 jQuery("#registerLoginPassword").attr("type", "text");
    	//jQuery("#registerLoginPassword").val('Asha')
    })*/
   

      
	jQuery(document).ready(function() {
		//get announcement div
		if(jQuery("#justforyou li").length > 1){
			
			jQuery("#justforyou").jCarouselLite({
				vertical: false,
				hoverPause:true,
				visible:1,
				auto:20000,
				speed:1500
			});
		}
		
		if(jQuery("#specialAlert li").length > 1){
			
			jQuery("#specialAlert").jCarouselLite({
				vertical: false,
				hoverPause:true,
				visible:1,
				auto:20000,
				speed:1500
			});
		}
		
		//announcement	
		if(jQuery("#announcement li").length > 1){
	
		jQuery("#announcement").jCarouselLite({
			vertical: false,
			hoverPause:true,
			visible: 1,
			auto:20000,
			speed:1500
		});
	}
	});
	jQuery(document).ready(function() {
	jQuery(function() {
		jQuery(".activeStyleFiles").jCarouselLite({
	        btnNext: ".prev",
	        btnPrev: ".next",
        	circular: false,
        	vertical: true,
        	visible: 3,
        	scroll:1,
        	speed: 800
	    });
		
		jQuery(".next").click(function(){
			if(jQuery(".next").hasClass("disabled")){
				
				jQuery(".next > img").css("opacity","0.4");
				jQuery(".prev > img").css("opacity","1");
			}else{jQuery(".prev > img").css("opacity","1");}
			
		});
		jQuery(".prev").click(function(){
			if(jQuery(".prev").hasClass("disabled")){
				
				jQuery(".prev > img").css("opacity","0.4");
				jQuery(".next > img").css("opacity","1");
			}else{
				
				jQuery(".next > img").css("opacity","1");}
			
		});
	});		
			
	jQuery(function() {
		jQuery(".mostLikedEntries").jCarouselLite({
	        btnNext: ".prev",
	        btnPrev: ".next",
        	circular: false,
        	vertical: true,
        	visible: 3,
        	scroll:1,
        	speed: 800
        	
        	
	    });
		
		jQuery(".next").click(function(){
			if(jQuery(".next").hasClass("disabled")){
				
				jQuery(".next > img").css("opacity","0.4");
				jQuery(".prev > img").css("opacity","1");
			}else{jQuery(".prev > img").css("opacity","1");}
			
		})
		jQuery(".prev").click(function(){
			if(jQuery(".prev").hasClass("disabled")){
				
				jQuery(".prev > img").css("opacity","0.4");
				jQuery(".next > img").css("opacity","1");
			}else{
				
				jQuery(".next > img").css("opacity","1");}
			
		})
	});
	
	jQuery(function() {
	      
	       jQuery(".styleLargeImages").jCarouselLite({
	           btnNext: ".nextLarge",
	           btnPrev: ".prevLarge",
	           circular: true,
	           vertical: false,
	           visible: 1,
	           scroll: 1,
	           speed: 800
	       });
	      
	     
	    });
	jQuery(function() {
		jQuery(".moreActiveStyleFiles").jCarouselLite({
	        btnNext: ".moreStylefilesRight",
	        btnPrev: ".moreStylefilesLeft",
        	circular: true,
        	vertical: false,
        	visible:3,
        	scroll: 1,
        	speed: 800
	    });
	});
	
	jQuery(function() {
		jQuery(".productsAssociatedWithArticle").jCarouselLite({
	        btnNext: ".prev",
	        btnPrev: ".next",
        	circular: false,
        	vertical: true,
        	visible: 4,
        	scroll: 1,
        	speed: 800
        });
		jQuery(".next").click(function(){
			if(jQuery(".next").hasClass("disabled")){
				
				jQuery(".next > img").css("opacity","0.4");
				jQuery(".prev > img").css("opacity","1");
			}else{jQuery(".prev > img").css("opacity","1");}
			
		})
		jQuery(".prev").click(function(){
			if(jQuery(".prev").hasClass("disabled")){
				
				jQuery(".prev > img").css("opacity","0.4");
				jQuery(".next > img").css("opacity","1");
			}else{
				
				jQuery(".next > img").css("opacity","1");}
			
		})
	});
	
	jQuery(function() {
		var allcat = jQuery(".productCategory")
		 jQuery.each(allcat, function(i, val) {
			
			 jQuery(".containerJcarousel"+val.id).jCarouselLite({
				    btnNext: ".right"+val.id,
			        btnPrev: ".left"+val.id,
		        	circular: true,
		        	vertical: false,
		        	visible: 3,
		        	scroll: 1,
		        	speed: 500
			 });
				 
				 
		    });


	});
	
	
	});
	
	jQuery('#FILTER3').datepicker();
	jQuery('#FILTER4').datepicker();
	
	
	
});


