diamondSearch = {    
    sliderInit: function( sliderObj, isReady ) {
        var sliderObj, isReady;
        
        if ( isReady == true ) {
            document.onmousemove = function( ){ diamondSearch.moveSlider( sliderObj ); return true; };
        } else if ( isReady == false ) {
            document.onmousemove = function( ){ return true; };
        }
    },
    
    moveSlider: function( sliderObj ) {
        var sliderObj;
        document.getElementById( "debuggg" ).innerHTML += parseInt( sliderObj.style.left ) + "<br />";
        sliderObj.style.left = ( sliderObj.style.left + 1 ) + "px";
    }
};
//---------------------------------------------------------------------- JavaScript For ringsize.html
function checkBeforeSend(){
	var ring_size_form = document.getElementById("ring_size_form");
	var error_alert = 0;
	var req_str = "";
	if(ring_size_form){
		var input_fields = ring_size_form.getElementsByTagName("INPUT");
		if(input_fields.length > 0){
			for(i=0; i<input_fields.length; i++){
				if(input_fields[i].type == "text"  && input_fields[i].name != "email"){
					if(TrimString(input_fields[i].value).length > 2){
						req_str += input_fields[i].name + "=" + input_fields[i].value + "&";
					}else{error_alert += 1;}
				}
				if(input_fields[i].type == "text" && input_fields[i].name == "email"){
					if(emailValidation(input_fields[i].value)){
						req_str += input_fields[i].name + "=" + input_fields[i].value + "&";
					}else{error_alert += 1;}
				}				
			}
		}
		var select_fields = ring_size_form.getElementsByTagName("SELECT");
		if(select_fields.length > 0){
			for(i=0; i<select_fields.length; i++){
				req_str += select_fields[i].name + "=" + select_fields[i].options[select_fields[i].selectedIndex].value;
			}
		}else{error_alert += 1;}
		if(error_alert > 0){
			alert("Please correct fill all required fields");
		}else{
			activateLightBox();
			sinh_ajax(req_str);
		}		
	}
}


function TrimString(sInString){
	return sInString.replace(/(^\s+)|(\s+$)/g, '');
}
function emailValidation(val){
	var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if(!filter.test(val)){
		return false;
	}else{
		return true;
	} 
}
function getXmlHttp(){
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}

function sinh_ajax(req){
      var xmlhttp = getXmlHttp(); 
      var req_str = '/assets/ajax/send_email_form.php';
         xmlhttp.open('POST', req_str, false); 
         xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 
         xmlhttp.send(req); 
	     if(xmlhttp.status == 200) { 
              return_content = xmlhttp.responseText; 
              if (return_content.length>0) {
              		//alert(return_content);
              } 
         }	
}

var isIE7 = false;
var isIE6 = false;
var isIE8 = false;
var lightTimer = 0;
var opacStep = 0;
var opac_value = 80;
function getBrowserType(){
	if ((navigator.userAgent.indexOf("MSIE 8")) >= 0){
		isIE8 = true;
		return;
	}
	if ((navigator.userAgent.indexOf("MSIE 6")) >= 0){
		isIE6 = true;
		return;
	}
	if ((navigator.userAgent.indexOf("MSIE 7")) >= 0){
		isIE7 = true;
		return;
	}
   	return false;
}
getBrowserType();
function activateLightBox(){
	var ring_size_form = document.getElementById("ring_size_form");
	if(ring_size_form){
		var hover = document.createElement("DIV");
		var opac_s = 0;
		hover.id = "transpLightDiv";
		hover.style.position = "absolute";
		if(isIE7 || isIE6){
			hover.style.top = ring_size_form.parentNode.offsetTop + ring_size_form.offsetTop +"px";
			hover.style.left = ring_size_form.parentNode.offsetLeft + "px";
		}else{
			hover.style.top = ring_size_form.offsetTop + "px";
			hover.style.left = ring_size_form.offsetLeft + "px";
		}					
		hover.style.width = ring_size_form.offsetWidth + "px";		
		hover.style.height = ring_size_form.offsetHeight + "px";
		hover.style.opacity = opac_s / 100;	
		hover.style.MozOpacity = opac_s / 100;	
		hover.style.KhtmlOpacity = opac_s / 100;
		hover.style.filter = "alpha(opacity = "+opac_s+")";
		hover.style.backgroundColor = "#FFFFFF";
		hover.style.color = "#000000";		
		hover.style.textAlign = "center";
		ring_size_form.appendChild(hover);
		hover.innerHTML = "<div style='margin-top: "+(hover.offsetHeight / 2 - 30 + "px")+"; font-weight: bold; font-size: 13px;'>Ring Sizer Request Submitted</div>";
		lightTimer = setInterval("lightBoxTransp('transpLightDiv',1)",5);
	}
}

function lightBoxTransp(obj_id, action){
	obj = document.getElementById(obj_id);
	if(obj){
		if(parseInt(action) == 1){
			if(opacStep < opac_value){
				opacStep += 2; 	
			}else{clearInterval(lightTimer);}
		}
		if(parseInt(action) == 2){
			if(opacStep > 0){
				opacStep -= 5;
			}else{
					mainLightDiv = document.getElementById("mainLightDiv");
					if(mainLightDiv){
						document.body.removeChild(mainLightDiv);
					}	
					clearInterval(lightTimer)
				}
		}
		obj.style.opacity = opacStep / 100;	
		obj.style.MozOpacity = opacStep / 100;	
		obj.style.KhtmlOpacity = opacStep / 100;
		obj.style.filter = "alpha(opacity = "+opacStep+")";
	}
}

//---------------------------------------------------------------------- JavaScript For ringsize.html