function clearMe(obj, text) {
	if(obj.value == text) {
					obj.value = '';
	}
}

function restoreMe(obj, text) {
	if(obj.value == '') {
					obj.value = text;
	}
}

(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery);

function adjustTextarea(textarea, collapsed) {
  var lines = textarea.value.split("\n");
  var count = lines.length;
  lines.each(function(line) { count += parseInt(line.length / 70); });

  var rows = parseInt(collapsed / 20);

  if (count > rows) {
    textarea.style.height = (collapsed * 2) + 'px';
  }

  if (count <= rows) {
    textarea.style.height = collapsed + 'px';
  }
}

function insertHTML(id, html) {
  $('#' + id).html(html);
}

$(document).ready(function(){
	$('#search-submit').hover(
		function(){ // Change the input image's source when we "roll on"
			$(this).attr({ src : 'http://dev.ovationtv.com/images/shared/search-submit-hover.png'});
		},
		function(){ // Change the input image's source back to the default on "roll off"
			$(this).attr({ src : 'http://dev.ovationtv.com/images/shared/search-submit.png'});
		}
	);
	
	$('li.submit input').hover(
		function(){ // Change the input image's source when we "roll on"
			$(this).attr({ src : '/images/shared/button_form_submit_hover.png'});
		},
		function(){ // Change the input image's source back to the default on "roll off"
			$(this).attr({ src : '/images/shared/button_form_submit.png'});
		}
	);
});
