function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
 	} else {
 		window.onload = function() {
 			if (oldonload) {
 				oldonload();
 			}
 			func();
 		}
 	}
}


function replaceImages() {

	//  Array syntax: original, replacement
	var img = Array(
			Array("/images/assets/module/ms-global-btn-scroll-left.gif","http://images.marthastewart.com/images/assets/msweddings/global/scrollbtn_left.gif"),
			Array("/images/assets/module/ms-global-btn-scroll-right.gif","http://images.marthastewart.com/images/assets/msweddings/global/scrollbtn_right.gif"),
			Array("/images/module/ms-global-btn-scroll-left.gif","http://images.marthastewart.com/images/assets/msweddings/global/scrollbtn_left.gif"),
			Array("/images/module/ms-global-btn-scroll-right.gif","http://images.marthastewart.com/images/assets/msweddings/global/scrollbtn_right.gif"),
			Array("/images/assets/module/registration/mc_save.gif","http://images.marthastewart.com/images/assets/msweddings/global/btn_submit.gif"),
			Array("/images/assets/module/registration/reg_submit.gif","http://images.marthastewart.com/images/assets/msweddings/global/btn_submit.gif"),
			Array("/images/assets/module/how_to/right.gif","http://images.marthastewart.com/images/assets/msweddings/global/right.gif"),
			Array("/images/assets/module/how_to/left.gif","http://images.marthastewart.com/images/assets/msweddings/global/left.gif"),
			Array("/images/assets/module/photo_gallery/begin.png","http://images.marthastewart.com/images/assets/msweddings/global/lpg_begin.png"),

			Array("/images/assets/module/weddingwire/icons/images/wedding/userhome/budget-48.png","http://www.marthastewartweddings.com/images/assets/module/weddingwire/icons/images/wedding/userhome/budget-48_rev.png"),
			Array("/images/assets/module/weddingwire/icons/images/wedding/userhome/hbudget.png","http://www.marthastewartweddings.com/images/assets/module/weddingwire/icons/images/wedding/userhome/hbudget_rev.png"),
			Array("/images/assets/module/weddingwire/icons/images/wedding/userhome/hguests.png","http://www.marthastewartweddings.com/images/assets/module/weddingwire/icons/images/wedding/userhome/hguests_rev.png"),
			Array("/images/assets/module/weddingwire/icons/images/wedding/userhome/htimeline.png","http://www.marthastewartweddings.com/images/assets/module/weddingwire/icons/images/wedding/userhome/htimeline_rev.png"),
			Array("/images/assets/module/weddingwire/icons/images/wedding/userhome/hvendors.png","http://www.marthastewartweddings.com/images/assets/module/weddingwire/icons/images/wedding/userhome/hvendors_rev.png"),
			Array("/images/assets/module/weddingwire/icons/images/wedding/userhome/to-dos.png","http://www.marthastewartweddings.com/images/assets/module/weddingwire/icons/images/wedding/userhome/to-dos_rev.png"),
			Array("/images/assets/module/weddingwire/icons/images/wedding/userhome/Wcountdown.png","http://www.marthastewartweddings.com/images/assets/module/weddingwire/icons/images/wedding/userhome/Wcountdown_rev.png"),
			Array("/images/assets/module/weddingwire/icons/images/wedding/userhome/whatsnew.png","http://www.marthastewartweddings.com/images/assets/module/weddingwire/icons/images/wedding/userhome/whatsnew_rev.png"),
			Array("/images/assets/module/weddingwire/icons/images/wedding/userhome/guest-48.png","http://www.marthastewartweddings.com/images/assets/module/weddingwire/icons/images/wedding/userhome/guest-48_rev.png"),
			Array("images/assets/module/weddingwire/icons/images/wedding/userhome/timeline-48.png","http://www.marthastewartweddings.com/images/assets/module/weddingwire/icons/images/wedding/userhome/timeline-48_rev.png"),
			
					
			// Array("/images/assets/module/registration/reg_cancel.gif", "http://images.marthastewart.com/images/assets/module/registration/reg_cancel.gif"),
			// Array("/images/assets/global/btns/enter_now.gif", "http://images.marthastewart.com/images/assets/global/btns/enter_now.gif"),
			// Array("/images/assets/global/btns/show_us_now.gif", "http://images.marthastewart.com/images/assets/global/btns/show_us_now.gif"),
			// Array("/images/assets/global/btns/upload_a_photo.gif", "http://images.marthastewart.com/images/assets/global/btns/upload_a_photo.gif"),
			Array("/images/assets/module/most_popular/grid_sort_desc.gif", "http://images.marthastewartweddings.com/images/assets/msweddings/global/sort_desc.gif"),
			Array("/images/assets/module/most_popular/grid_sort_asc.gif","http://images.marthastewartweddings.com/images/assets/msweddings/global/sort_asc.gif")
			);

	var input = Array(
			Array("/images/assets/module/registration/reg_submit.gif", "http://images.marthastewart.com/images/assets/msweddings/global/btn_submit.gif"),
			// Array("/images/assets/module/registration/reg_create_my_account.gif", "http://images.marthastewart.com/images/assets/module/registration/reg_create_my_account.gif"),
			// Array("/images/assets/module/community/edit_profile/edit_profile_preview_btn.gif", "http://images.marthastewart.com/images/assets/module/community/edit_profile/edit_profile_preview_btn.gif"),
			// Array("/images/assets/module/community/edit_profile/edit_profile_save_btn.gif", "http://images.marthastewart.com/images/assets/module/community/edit_profile/edit_profile_save_btn.gif"),
			Array("/images/assets/module/registration/mc_submit.gif", "http://images.marthastewart.com/images/assets/msweddings/global/btn_submit.gif"),
			// Array("/images/assets/module/registration/mc_cancel.gif", "http://images.marthastewart.com/images/assets/module/registration/mc_cancel.gif"),
			// Array("/images/assets/global/btns/save.gif", "http://images.marthastewart.com/images/assets/global/btns/save.gif"),
			Array("/images/assets/global/icons/search_btn.gif", "http://images.marthastewart.com/images/assets/msweddings/global/btn_search.gif")
			);

	var r_img = document.getElementsByTagName("img");
	for (var i = 0; i < r_img.length; i++) {
		// loop through all images on page to see if any of them are on the shit list
		for (var j = 0; j < img.length; j++) {
			if (r_img[i].src.indexOf(img[j][0]) != -1) {
				r_img[i].src = img[j][1];
				// document.images[i].src = img[j][1];
			}
		}
	}
	
	var r_input = document.getElementsByTagName("input");
	for (var i = 0; i < r_input.length; i++) {
		// loop through all inputs on page to see if any of them are on the shit list
		for (var j = 0; j < input.length; j++) {
			if (r_input[i].src.indexOf(input[j][0]) != -1) {
				r_input[i].src = input[j][1]
				// document.input[i].src = input[j][1];
			}
		}
	}
}

addLoadEvent(replaceImages);