(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preloadImages = function(items) {
    for (var i in items) {
      if($(items[i][0]).length > 0)
      {
        var cacheImage = document.createElement('img');
        cacheImage.src = 'img.php?img=' + items[i][1];
        cache.push(cacheImage);
        cacheImage.src = 'img.php?img=' + items[i][2];
        cache.push(cacheImage);
      }
    }
  }
})(jQuery)



//// URL Redirection   /////////////
url = document.location.href;

the_length = url.length;
last_char = url.charAt(the_length-1);

var mmmmm = window.location.pathname;

    var PageName = mmmmm.substring(mmmmm.lastIndexOf('/') + 1);   
	
if(PageName == 'cart.php' || PageName == 'payment_cc.php')
{
	// do nothing
}
else
{
	if(last_char=="/")
	{
		window.location = url+"?";
	}
	else if(last_char=="?")
	{
	
	}
	else
	{
		window.location = url+"/?";
	}
}


/*if(url == "http://honey.jtechgrp.com/sale/")
{
	window.location = 'http://honey.jtechgrp.com/sale/?';
}
else if(url == "http://honey.jtechgrp.com/jewelry")
{
	window.location = 'http://honey.jtechgrp.com/jewelry/?'
}
else if(url == "http://honey.jtechgrp.com/sale")
{
	window.location = 'http://honey.jtechgrp.com/sale/?'
}
else if(url == "http://honey.jtechgrp.com/jewelry/")
{
	window.location = 'http://honey.jtechgrp.com/jewelry/?'
}
else if(url == "http://honey.jtechgrp.com/all" || url == "http://honey.jtechgrp.com/all/")
{
	window.location = 'http://honey.jtechgrp.com/all/?'
}
else if(url == "http://honey.jtechgrp.com/exclusives" || url == "http://honey.jtechgrp.com/exclusives/")
{
	window.location = 'http://honey.jtechgrp.com/exclusives/?'
}*/


//// URL Redirection Ends  ////////

$(document).ready(function() {

 /*if(logged_in)
 {
  var items = [
  ["#header .line1 #item_login a img","my_account","my_account_sel"],
  ["#header .line1 #item_shopping_bag a img","shopping_bag","shopping_bag_sel"],
  ["#header .line2 #item1 a img","what_is_new","what_is_new_sel"],
  ["#header .line2 #item2 a img","swimwear","swimwear_sel"],
  ["#header .line2 #item3 a img","cover_ups","cover_ups_sel"],
  ["#header .line2 #item4 a img","designers","designers_sel"],
  ["#header .line2 #item_about a img","about","about_sel"],
  ["#header .line2 #item_contact a img","contact","contact_sel"],
  ["#bottom_menu #item_customer_service a img","customer_service","customer_service_sel"],
  ["#bottom_menu #item_twitter a img","twitter","twitter_sel"],
  ["#bottom_menu #item_facebook a img","facebook","facebook_sel"],
  ["#bottom_menu #item_blog a img","blog","blog_sel"],
  [".menu-categories-list2 #img_modify_profile","modify_profile","modify_profile_sel"],
  [".menu-categories-list2 #img_order_history","order_history","order_history_sel"],
  [".menu-categories-list2 #img_log_out","log_out","log_out_sel"]
  ];
 } else {
  var items = [
  ["#header .line1 #item_login a img","login","login_sel"],
  ["#header .line1 #item_shopping_bag a img","shopping_bag","shopping_bag_sel"],
  ["#header .line2 #item1 a img","what_is_new","what_is_new_sel"],
  ["#header .line2 #item2 a img","swimwear","swimwear_sel"],
  ["#header .line2 #item3 a img","cover_ups","cover_ups_sel"],
  ["#header .line2 #item4 a img","designers","designers_sel"],
  ["#header .line2 #item_about a img","about","about_sel"],
  ["#header .line2 #item_contact a img","contact","contact_sel"],
  ["#bottom_menu #item_customer_service a img","customer_service","customer_service_sel"],
  ["#bottom_menu #item_twitter a img","twitter","twitter_sel"],
  ["#bottom_menu #item_facebook a img","facebook","facebook_sel"],
  ["#bottom_menu #item_blog a img","blog","blog_sel"],
  [".menu-categories-list2 #img_modify_profile","modify_profile","modify_profile_sel"],
  [".menu-categories-list2 #img_order_history","order_history","order_history_sel"],
  [".menu-categories-list2 #img_log_out","log_out","log_out_sel"]
  ];
 }
 
 jQuery.preloadImages(items); */
 
/*
  $("#header .line2 #item_about a img").bind("mouseenter",function(){
      $(this).attr("src",'skin1/images/navigation/about_sel.jpg');
    }).bind("mouseleave",function(){
      $(this).attr("src",'skin1/images/navigation/about.jpg');
    });  
 
  $("#header .line2 #item_contact a img").bind("mouseenter",function(){
      $(this).attr("src",'skin1/images/navigation/contact_sel.jpg');
    }).bind("mouseleave",function(){
      $(this).attr("src",'skin1/images/navigation/contact.jpg');
    });  
 

 var i;
 for(i in items) 
 {
   if($(items[i][0]).length > 0)
   {
     //alert(items[i][0]+':'+items[i][2]+':'+items[i][1]);
     $(items[i][0]).bind("mouseenter",{img: items[i][2]}, function(event){
         if($(this).attr('class').indexOf("no_rollover")==-1)
         {
          $(this).attr("src",'img.php?img=' + event.data.img);
         }
       }).bind("mouseleave",{img: items[i][1]},function(event){
         if($(this).attr('class').indexOf("no_rollover")==-1)
         {
          $(this).attr("src",'img.php?img=' + event.data.img);
         }
       });  
   }
 }*/

});

/*$(document).ready(
function()
{
	$("#nlink_294").click(
	function()
	{
		alert("go");
		window.location = "http://www.sirenecollection.com/SALE-ITEMS";
	});
	
	$("#nlink_293").click(
	function()
	{
		window.location = "http://www.sirenecollection.com/BEST-SELLERS";
	});
});*/

function new_img(n,id)
{
	$("#"+id).attr("src","/skin1/images/navigation/"+n);
}

$(document).ready(
function()
{
	$('.market-price').each(
	function()
	{
		$('.market-price').css({'color':'#172448'});
	});
	
	$('.currency').each(
	function()
	{
		$('.currency').css({'color':'#172448'});
	});
	
	$('.product-title').each(
	function()
	{
		$('.product-title').css({'color':'#172448'});
	});
	
	$('.producttitle').each(
	function()
	{
		$('.producttitle').css({'color':'#172448'});
	});
	
	$('.product_price').each(
	function()
	{
		$('.product_price').css({'color':'#172448'});
	});
	
	//alert(c);
	//return false;
	
	/*$(".market-price-value").each(
	function()
	{
		c = $(".market-price-value").html();
		
		if(c!=null)
		{
			//alert(c);
			more = c.split('$');
			more_more = more[1].split('<');
			
			orignal_price = $.trim(more_more[0]);
			
		
			if(orignal_price!="")
			{
				//alert(orignal_price);
				//$('.market-price').html('');
				d = $('.market-price').prev('.price-row').html();
				alert(d);
				get = d.split('$');
				get_more = get[1].split('<');
			
				discount_price = $.trim(get_more[0]);
				
				//alert(discount_price);
				
				$('.market-price').closest('.price-row').hide();
				
				$('.market-price').html('<font color="#FE2C02">$'+discount_price+'</font>&nbsp;&nbsp;<span style="color:#172448"><del>$'+orignal_price+'</del></span>');
				
			}
		}
	});*/
	
	//class="currency">
	
	$('td .market-price').each(
	function()
	{
		//alert($(this).html());
		k = $(this).html();
		//alert(k);
		
		m = k.split('class="currency">');
		m1 = m[1].split('<');
		market = $.trim(m1[0]);
		//alert(market);
		
		j = $(this).prev('.price-row').html();
		
		s = j.split('class="currency">');
		s1 = s[1].split('<');
		
		selling = $.trim(s1[0]);
		//alert(selling);
		
		$(this).prev('.price-row').html('<font color="#FE2C02">'+selling+'</font>&nbsp;&nbsp;<span style="color:#172448"><del>'+market+'</del></span>');
		$(this).html(' ');
		
	});
	
	
	
	var nVer = navigator.appVersion;
	var nAgt = navigator.userAgent;
	var browserName  = navigator.appName;
	var fullVersion  = ''+parseFloat(navigator.appVersion); 
	var majorVersion = parseInt(navigator.appVersion,10);
	var nameOffset,verOffset,ix;
	if ((verOffset=nAgt.indexOf("MSIE"))!=-1) 
	{
 		browserName = "Microsoft Internet Explorer";
 		$('#bg_my_pro').css({'z-index':'-4000'});
		$('#new_customer').css({'z-index':'9000'});
	}
	
		setTimeout('show_everything()',1000);
		//setTimeout('fixPNGs()',1000);
		
		
		// shipping box style remove attr
		
		setTimeout("$('#ship_box').removeAttr('style');",1000);
		//alert('working');
		
});

function show_everything()
{
	$(':input').each(
	function()
	{
		k = $(this).show();
		//alert(k);
	});
	
	$('#button_create_account').css({'visibility':'visible','position':'absolute'});
	$('#button_create_account').attr('width','100');
}

function fixPNGs(){
  if(jQuery.browser.msie && jQuery.browser.version < 9){ 
 var i;
 //alert(document.images.length);
 for(i in document.images){
   if(document.images[i].src){
  var imgSrc = document.images[i].src;
  if(imgSrc.substr(imgSrc.length-4) === '.png' || imgSrc.substr(imgSrc.length-4) === '.PNG'){
  document.images[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='" + imgSrc + "')";
  }
   }
 } 
  }
}

