
function alertContents() {
  if (http_request.readyState == 4) {
	 if (http_request.status == 200) {
		//alert(http_request.responseText);
		result = http_request.responseText;
		document.getElementById('successMessage').innerHTML = result;            
	 } else {
		alert('There was a problem with the request.');
	 }
  }
}

function stretchHeight() {
	var elm = document.getElementById('contentContainer');
	elm.style.height = 'auto';
	var x = elm.offsetHeight;
	elm.style.height = x + "px";
}
//function background() {};

background = new background();
number = 0;
countImages = 3 ;  //total images

// imageArray 
for (var i=1; i < countImages; i++) {
	// keep adding items here...
	background[number++] = "<style type='text/css'>#header h1 {background:url(images/common/logos/logo-small-navidad" + i + ".png) 50% 0 no-repeat;}" +
	                       "#secondary #header h1 {background:url(images/common/logos/logo-secondary-navidad" + i + ".jpg) 0 0 no-repeat;}</style>"
	
}

increment = Math.floor(Math.random() * number);
document.write(background[increment]);	
function workInit() {
	var thumbnails = getElementsByClassName(document, "a", "workpic");

	for (i=0;i<thumbnails.length;i++) {
		thumbnails[i].onclick = function() {
			for (i=0;i<thumbnails.length;i++) {
				thumbnails[i].className = thumbnails[i].className.replace(new RegExp("( ?|^)select\\b"), "");
			}
			this.blur();
			this.className += " select";
			
			var url = "";
			var dir = "";
			
			var href = this.getAttribute("href");
			var firstpos = href.lastIndexOf("/");
			var lastpos = href.lastIndexOf("/");
			
			var id = href.substring(firstpos+dir.length,lastpos);

			var params = 'id=' + id;
			new Ajax.Updater('workscontent', '', {parameters:params, method: 'get'});
			$('workscontent').style.top = "300px";
			return false;
		}
	}
}

function reportError(request) {
 alert ("error");
}

function addEvent( obj, type, fn ) {
	if ( obj.attachEvent ) {
		obj['e'+type+fn] = fn;
		obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
		obj.attachEvent( 'on'+type, obj[type+fn] );
	} else
		obj.addEventListener( type, fn, false );
	}
	
function removeEvent( obj, type, fn ) {
	if ( obj.detachEvent ) {
		obj.detachEvent( 'on'+type, obj[type+fn] );
		obj[type+fn] = null;
	} else
		obj.removeEventListener( type, fn, false );
	}