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 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 );
	}
	
function showFlash() {
	var oDiv = document.getElementById("flashContainer");
	oDiv.style.display = "block";
}

function hideFlash() {
	var oDiv = document.getElementById("flashContainer");
	oDiv.style.display = "none";
}
function roundCorners(){
	/* CurvyCorners */
	/*
      The new 'validTags' setting is optional and allows
      you to specify other HTML elements that curvyCorners
      can attempt to round.

      The value is comma separated list of html elements
      in lowercase.

      validTags: ["div", "form"]

      The above example would enable curvyCorners on FORM elements.
      */
      settings = {
          tl: { radius: 6 },
          tr: { radius: 6 },
          bl: { radius: 6 },
          br: { radius: 6 },
          antiAlias: true,
          autoPad: true,
          validTags: ["div"]
      }

      /*
      Usage:

      newCornersObj = new curvyCorners(settingsObj, classNameStr);
      newCornersObj = new curvyCorners(settingsObj, divObj1[, divObj2[, divObj3[, . . . [, divObjN]]]]);
      */
      var myBoxObject = new curvyCorners(settings, "menudiv");
      myBoxObject.applyCornersToAll();
  
   	  settingsMainNav = {
          tl: { radius: 0 },
          tr: { radius: 0 },
          bl: { radius: 6 },
          br: { radius: 6 },
          antiAlias: true,
          autoPad: true,
          validTags: ["div"]
      }
  	 /* var divObj = document.getElementById("mainNav"); 

      var cornersObj = new curvyCorners(settingsMainNav, divObj);
      cornersObj.applyCornersToAll();*/
      
      /*	-------------------------------------------------------------
	    function setLinkAttributes()
	  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	  Description:	setLinkAttributes finds ALL anchor links and
					can set new attributes. The following script
					specifically finds anchor links labeled as
					external, and add a terget="_blank". We do
					in order to validate in XHTML 1.1 Strict.
	   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	   Credits:		Script found on Site Point (I think)
					http://www.sitepoint.com
	   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -	*/
       
       if (!document.getElementsByTagName) return;
	  
	   var anchors = document.getElementsByTagName("a");
	   for (var i=0; i<anchors.length; i++) {
		    var anchor = anchors[i];
    		
		    if (anchor.getAttribute("href") && ( anchor.getAttribute("rel") == "external" || anchor.getAttribute("rel") == "nofollow" ) ) {
			    anchor.target = "_blank";
		    }
	   }
}