var curImgOn = ''
	function imgOn(imgName) {
	   if (document.images) {
    	   document[imgName].src = "/media/" + imgName + "_on.gif";
       }
	}
	function imgOff(imgName) {
		if (document.images) {
			if (curImgOn != null && curImgOn != document[imgName].src) {
				document[imgName].src = "/media/" + imgName + ".gif";
			}
		}
	}	




function flipLayer (layername) 
{
// turn all the layers off one by one
document.getElementById('layer1').style.display = 'none';
document.getElementById('layer2').style.display = 'none';
document.getElementById('layer3').style.display = 'none';
document.getElementById('layer4').style.display = 'none';

//turn the layer you want to show on
document.getElementById(layername).style.display = 'block';
if(layername == 'layer1')
 {
	document['lay3'].src = "images/product_reviews_inactive.gif";
	document['lay1'].src = "images/product_details_active.gif";
	document['lay2'].src = "images/product_specs_inactive.gif";
	document['lay4'].src = "images/product_video_inactive.gif";

 }else if(layername == 'layer2'){
	document['lay3'].src = "images/product_reviews_inactive.gif";
 	document['lay1'].src = "images/product_details_inactive.gif";
	document['lay2'].src = "images/product_specs_active.gif";
	document['lay4'].src = "images/product_video_inactive.gif";

  }else if(layername == 'layer3'){
	document['lay3'].src = "images/product_reviews_active.gif";
 	document['lay1'].src = "images/product_details_inactive.gif";
	document['lay2'].src = "images/product_specs_inactive.gif";
	document['lay4'].src = "images/product_video_inactive.gif";

  }else{
	document['lay4'].src = "images/product_video_active.gif";
 	document['lay1'].src = "images/product_details_inactive.gif";
	document['lay2'].src = "images/product_specs_inactive.gif";
	document['lay3'].src = "images/product_reviews_inactive.gif";
  }
}






function HideDIV(d) { document.getElementById(d).style.display = "none"; }
function DisplayDIV(d) { document.getElementById(d).style.display = "block"; }



function fade(messId,destLink) {
if(!document.getElementById) return true;
if(!document.getElementById("popup")) return true;

var hide = document.getElementById("popup");
var htmlEl = document.getElementsByTagName('html')[0];
var mesEl = document.getElementById(messId);
var dest = "#" + destLink;
if(htmlEl.id == null) return true;
		if(htmlEl.id =="fade-off") {
			htmlEl.id=htmlEl.id.replace(new RegExp("fade-off\\b"), "fade-on");
			mesEl.style.display="block";
			return false;
			}
			else if (htmlEl.id =="fade-on") {		
			htmlEl.id=htmlEl.id.replace(new RegExp("fade-on\\b"), "fade-off");
		 	mesEl.style.display="none";
			window.location = dest;
			return false;
		}
 return true;
}


function mySwap(s)
{

if ( s == 0 )document.images.lab.src = "images/menu-img/online-lab-up.gif";
if ( s == 1 )document.images.lab.src = "images/menu-img/online-lab-down.gif";

if ( s == 2 )document.images.photogooru.src = "images/menu-img/photogooru-up.gif";
if ( s == 3 )document.images.photogooru.src = "images/menu-img/photogooru-down.gif";

if ( s == 4 )document.images.monthlyphoto.src = "images/menu-img/monthly-photo-up.gif";
if ( s == 5 )document.images.monthlyphoto.src = "images/menu-img/monthly-photo-down.gif";

if ( s == 6 )document.images.help.src = "images/menu-img/help-up.gif";
if ( s == 7 )document.images.help.src = "images/menu-img/help-down.gif";
}
function HideDIV(d) { document.getElementById(d).style.display = "none"; }
function DisplayDIV(d) { document.getElementById(d).style.display = "block"; }

window.onload = function () {
var myDate=new Date();
myDate.setFullYear(2010,0,28);
var today = new Date();

if (myDate>=today)
  {

  }
else
  {
  $('.nikonpromo').remove();
  $('.6').remove();
  }

};


jQuery(document).ready(function($){


$.localScroll();

  $('.items').cycle({
    fx:     'shuffle',
    speed:    1000, 
    timeout:  7000,
    pause: 1
  });  


$("a.fancify").fancybox({

		'overlayShow'			: true,
                'overlayOpacity'                : .90,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
                'frameWidth'                    : 1024,
                'frameHeight'                   : 600

}); 

$("a.helpify").fancybox({

		'overlayShow'			: true,
                'overlayOpacity'                : .90,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
                'frameWidth'                    : 860,
                'frameHeight'                   : 500

}); 


$("a.smallify").fancybox({

		'overlayShow'			: true,
                'overlayOpacity'                : .70,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
                'frameWidth'                    : 600,
                'frameHeight'                   : 300

}); 


var today_date= new Date();
var myDay=today_date.getDay();

if (myDay > 4) {
$(".message-area").append("<div class='notice'>Roberts Imaging does not process, bill, or ship orders placed after 1:00 PM EDT/EST Friday until the following Monday. If you have a question concerning your order we are in Saturdays from 9:00 AM - 4:30 PM EDT/EST.</div>");
};

$("input[name='international']").click(function(){

if ($("input[name='international']:checked").val() == "usa"){
$("input[name='address1']").rules("add", {required:true});

} else {

$("input[name='address1']").rules("remove", {required:true});

}



}); 



$(".jqtransformcard").validate({			


		rules: {

      paytype: {
				required: true,
				minlength: 1
			},
			cardno: "required",
			cvv: "required",
			cardname: "required"
			},
			errorPlacement: function(error, element) {
			error.appendTo( element.parent().parent().next() );
		},
		errorClass: "error_form"
});
			             
			             
			             
			             
// validate signup form on keyup and submit
        $(".jqtransform").validate({			


		rules: {
			firstname6til43: "required",
			lastnamefujiur: "required",
			itemname: "required",

			custemailn5x0da: {
				required: true,
				email: true
			},
			custphone407erf: "required",
			list: {
				required: "#newsletter:checked",
				minlength: 1
			},
			productName: { 
				selectNone: true 
			},
			
			whoTo: { 
				selectNone: true 
			},
						
			fname: "required",
			lname: "required",
			email: {
				required: true,
				email: true
			},
			
			address1: "required",
			city: "required",
			phoneNew: "required",

      stateNew: "required",
			zip:  {
				required: true,
				minlength: 5
			},
     intphone: {
				required: true,
				minlength: 7
			},
     intaddress1:  "required",
     intcity:  "required",
     intregion:  "required",
     intcountry:  "required",
     intpostal:  {
				required: true,
				minlength: 4
			}

			
                 
             },


		messages: {
			firstname6til43: "We Need Your First and Last Name",
			lastnamefujiur: "We Need Your First and Last Name",

			custemailn5x0da: "Your Email Is Required",
			custphone407erf: "Your Phone Numer Is Required",

			list: "If you wish to subscribe, please choose at least one list to receive"


		},

                errorPlacement: function(error, element) {
			error.appendTo( element.parent().parent().next() );
		},
		errorClass: "error_form"


	});
	
	
	

	//code to hide topic selection, disable for demo
	var newsletter = $("#newsletter");
	// newsletter topics are optional, hide at first
	var inital = newsletter.is(":checked");
	var topics = $("#newsletter_topics")[inital ? "removeClass" : "addClass"]("gray");
	var topicInputs = topics.find("input").attr("disabled", !inital);
	// show when newsletter is checked
	newsletter.click(function() {
		topics[this.checked ? "removeClass" : "addClass"]("gray");
		topicInputs.attr("disabled", !this.checked);
	});
	

	
	



	// validate the comment form when it is submitted

jQuery.validator.addMethod(
  "selectNone",
  function(value, element) {
    if (element.value == "none")
    {
      return false;
    }
    else return true;
  },
  "Please Choose An Option."
);



$("#f_phone").mask("(999) 999-9999",{placeholder:" "});
$("#phoneNew").mask("(999) 999-9999",{placeholder:" "});
$("#phoneCell").mask("(999) 999-9999",{placeholder:" "});

$("#cc_type").change(
    function() {
      switch ($(this).val()){
        case 'am':
          $("#cardno").unmask().mask("9999 999999 99999");
          break;
        default:
          $("#cardno").unmask().mask("9999 9999 9999 9999");
          break;
      }
    }
);



	// select #flowplanes and make it scrollable. use circular and navigator plugins
	$("#flowpanes").scrollable({size: 1,speed: 1000,clickable: false}).circular().autoscroll(5000).navigator({

		// select #flowtabs to be used as navigator
		navi: "#flowtabs",

		// select A tags inside the navigator to work as items (not direct children)
		naviItem: "a",

		// assign "current" class name for the active A tag inside navigator
		activeClass: "current"


	});
	
	
	
$("input").hover(
function () {
        $(this).addClass("highlight");
      }, 
      function () {
        $(this).removeClass("highlight");
      }
    );

$("input").focus(function () {
         $(this).addClass("focused");
});


$("input").blur(function () {
         $(this).removeClass("focused");
});





$("select").hover(
function () {
        $(this).addClass("highlight");
      }, 
      function () {
        $(this).removeClass("highlight");
      }
    );

$("select").focus(function () {
         $(this).addClass("focused");
});


$("select").blur(function () {
         $(this).removeClass("focused");
});


$("textarea").hover(
function () {
        $(this).addClass("highlight");
      }, 
      function () {
        $(this).removeClass("highlight");
      }
    );

$("textarea").focus(function () {
         $(this).addClass("focused");
});


$("textarea").blur(function () {
         $(this).removeClass("focused");
});

	

});

