


$('#tb1').mousedown(function(){
	if($(this).hasClass("selected"))
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab1").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
	
	else
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab1").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
});

$('#tb2').mousedown(function(){
	if($(this).hasClass("selected"))
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab2").delay(100).show();
	$(this).addClass("selected");
    $(this).css("color","#0C96BD");
	}
	
	else
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab2").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
});

$('#tb3').mousedown(function(){
	if($(this).hasClass("selected"))
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab3").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
	
	else
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab3").delay(100).show();
	$(this).addClass("selected");
    $(this).css("color","#0C96BD");
	}
});

$('#tb4').mousedown(function(){
	if($(this).hasClass("selected"))
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab4").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
	
	else
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab4").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
});

$('#tb5').mousedown(function(){
	if($(this).hasClass("selected"))
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab5").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
	
	else
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab5").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
});

$('#tb6').mousedown(function(){
	if($(this).hasClass("selected"))
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab6").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
	
	else
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab6").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
});

$('#tb7').mousedown(function(){
	if($(this).hasClass("selected"))
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab7").delay(100).show();
	$(this).addClass("selected");
    $(this).css("color","#0C96BD");
}
	
	else
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab7").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
});

$('#tb8').mousedown(function(){
	if($(this).hasClass("selected"))
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tb1,#tb2,#tb3,#tb4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab8").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
	
	else
	{
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').hide();
	$('#tab1,#tab2,#tab3,#tab4,#tab5,#tab6,#tab7,#tab8').removeClass("selected");
	$("#usual1 a").css("color","#1C2E88");
	$("#tab8").delay(100).show();
	$(this).addClass("selected");
	$(this).css("color","#0C96BD");
	}
});

$(document).ready(function() {

//By this Set Submenu
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}


var getSection=getUrlVars()["section"];
var getTabIndex=(getUrlVars()["tabIndex"]-1);

if(getSection!=''||getUrlVars()["page"]!='')
{
	
if((getSection=='designyourown')||(getSection=='bridal'))
    {
	$('#tb3').mousedown();
    $("#tab3").children('a').eq(getTabIndex).css("color","#0C96BD");
}
else if(getSection=='jewelry')
    {
    $("#tb1").mousedown();
    $("#tab1").children('a').eq(getTabIndex).css("color","#0C96BD");
	
    }

else if(getSection=='colorlessdiamonds')
    {
	$("#tb6").mousedown();
   $("#tab6").children('a').eq(getTabIndex).css("color","#0C96BD");
    }
    
else if(getSection=='timePieces')
    {
    $("#tb4").mousedown();
    $("#tab4").children('a').eq(getTabIndex).css("color","#0C96BD");
    }
     
else if(getSection=='mens')
   {
   $("#tb4").mousedown();
   $("#tab4").children('a').eq(getTabIndex).css("color","#0C96BD");
    }
   
else if(getSection=='gifts')
  {
  $("#tb5").mousedown();
  $("#tab5").children('a').eq(getTabIndex).css("color","#0C96BD");
    
  }
else if(getSection=="Estate")
{
   $("#tb7").mousedown();
   $("#tab7").children('a').eq(getTabIndex).css("color","#0C96BD");
    }
	
	
else if(getUrlVars()["page"]=="customdesigned")
{
	$("#tb2").mousedown();
	
}	
}


});


//Check array
var storeLodedIframe = new Array();
storeLodedIframe[0]=0;
/*Array.prototype.find = function(searchStr) {
  var returnArray = false;
  for (i=0; i<this.length; i++) {
    if (typeof(searchStr) == 'function') {
      if (searchStr.test(this[i])) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    } else {
      if (this[i]===searchStr) {
        if (!returnArray) { returnArray = [] }
        returnArray.push(i);
      }
    }
  }
  return returnArray;
}*/

///
function changeFrame(d){





if(d>0){
	
var curr = document.getElementById('currentie').innerHTML;
 var elem = "#ie"+curr;
 
 $(elem).fadeOut("slow");
 setTimeout('', 2000 );
document.getElementById('currentie').innerHTML=d-1;
nextie();

}else {
var curr = document.getElementById('currentie').innerHTML;
 var elem = "#ie"+curr;
 
 $(elem).fadeOut("slow");
 setTimeout('', 2000 );
document.getElementById('currentie').innerHTML=1;
previe();
}

if(d>0)
 { 
if(!(jQuery.inArray(d,storeLodedIframe) > -1))
{
	var arryLength=storeLodedIframe.length;
showRecord("ie"+d,"storeIframe"+d);
storeLodedIframe[arryLength]=d;

			  } 


 }
 
}
function nextie(){
 var curr = document.getElementById('currentie').innerHTML;
 var elem = "#ie"+curr;
 $(elem).fadeOut("slow");
 curr++;
 if(curr == document.getElementById('countie').innerHTML)
 curr=0;
 elem = "#ie"+curr;
 setTimeout('', 2000 );
 document.getElementById('currentie').innerHTML=curr;
 $(elem).fadeIn("slow");
}

function previe(){
 var curr = document.getElementById('currentie').innerHTML;
 var elem = "#ie"+curr;
 $(elem).fadeOut("slow");
 curr--;
 if(curr < 0)
 curr=(document.getElementById('countie').innerHTML)-1;
 elem = "#ie"+curr;
 setTimeout('', 2000 );
 document.getElementById('currentie').innerHTML=curr;
 $(elem).fadeIn("slow");
}
function change_parent_url(url)
{
    document.location=url;
}
function setHeight(n){
 var curr = document.getElementById('currentie').innerHTML;
 var elem = "#ie"+curr;
 $(elem).height(n);
$('#eiframe').height(n);
$('#eprev').fadeOut();
$('#enext').fadeOut();
$('#gallery').fadeOut();
window.stop();
document.execCommand('Stop');
}

function scrRight(){
var tot = document.getElementById('countie').innerHTML;
tot*=129;
var d = $("#scrt").css("margin-left").replace("px", "");
d=parseInt(d);

/*if(d == 0)
{
d=-129;
}
*/

if(d>(858-tot)){
	
d-=6*129;}
/*
Use for repete
else{
//d=(858-tot);
alert("else");
}*/
smoother(d);
}

function scrLeft(){
var d = $("#scrt").css("margin-left").replace("px", "");
d=parseInt(d);
if(d<0)
d+=129*6;
if(d>-129)
d=0;
smoother(d);
}

function smoother(d) {
  $('#scrt').animate({
    marginLeft: d
  },300, function() {
    // Animation complete.
  });
}

var popupStatus = 0;  
var loadPopup = function (id,img,txt) {
document.mainImg.src = img;
document.getElementById('mainDesc').innerHTML=txt;
if(popupStatus===0){
jQuery("#backgroundPopup").css({
"opacity": "0.7"
});
jQuery("#backgroundPopup").fadeIn("slow");
if(id=='1')
jQuery("#popupContact1").fadeIn("slow");
if(id=='2'){
document.getElementById('contact2').src = document.getElementById('contact2').src;
jQuery("#popupContact2").fadeIn("slow");}
if(id=='3'){
document.getElementById('contact1').src = document.getElementById('contact1').src;
jQuery("#popupContact3").fadeIn("slow");}
popupStatus = 1;
}
};
var disablePopup = function () {
if(popupStatus===1){
jQuery("#backgroundPopup").fadeOut("slow");
jQuery("#popupContact1").fadeOut("slow");
jQuery("#popupContact2").fadeOut("slow");
jQuery("#popupContact3").fadeOut("slow");
popupStatus = 0;
}
};
var centerPopup = function () {
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupHeight = jQuery("#popupContact1").height();
var popupWidth = jQuery("#popupContact1").width();
jQuery("#popupContact1").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});
var popupHeight = jQuery("#popupContact2").height();
var popupWidth = jQuery("#popupContact2").width();
jQuery("#popupContact2").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});
var popupHeight = jQuery("#popupContact3").height();
var popupWidth = jQuery("#popupContact3").width();
jQuery("#popupContact3").css({
"position": "absolute",
"top": windowHeight/2-popupHeight/2,
"left": windowWidth/2-popupWidth/2
});
jQuery("#backgroundPopup").css({
"height": windowHeight
});

};
 
    jQuery(document).ready(function () {  

jQuery("#popupContactClose").click(function () {  
disablePopup();  
});  

jQuery("#backgroundPopup").click(function() {  
disablePopup();  
});  
//Press Escape event!  
jQuery(document).keypress(function (e) {  
if(e.keyCode==27 && popupStatus==1){  
disablePopup();  
}  
});  
    });  


var getprodImg = function(){
return document.mainImg.src;}

var getprodInfo = function(){
return document.getElementById('mainDesc').innerHTML;
}


function showRecord(iframeId,intextId)
{
	var SetUrl=document.getElementById(intextId).value+"&showIframe=show";
document.getElementById(iframeId).src=SetUrl;
	
	return true;
//alert("3333");	
document.getElementById(iframeId).contentWindow.location.reload();

/*
//var SplitedStr=SetUrl.split("?");
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    var responseData=xmlhttp.responseText;
	document.getElementById(iframeId).contentDocument.body.innerHTML =responseData;
    }
  }
xmlhttp.open("GET",SetUrl,true);
xmlhttp.send();
*/
	  
}
