function checkUncheckAll(theElement) {
 	var theForm = theElement.form, z = 0;
 	for(z=0; z<theForm.length;z++)
	{
  		if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
		{
  			theForm[z].checked = theElement.checked;
  		}
 	}
}
function confirmation(loc,msg)
{
	var answer = confirm(msg);
	if (answer)
	{
		location.href = loc;
	}
}
function openwindow(url,name,width,height,option) {
	if(option == "")
	{
		option = "toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=no,resizable=no,copyhistory=no"
	}
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
    var windowFeatures = "width=" + width + ",height=" + height + "," + option + ",left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
    myWindow = window.open(url, name, windowFeatures);
}
function selectradio(id)
{
	var radio = document.getElementById(id);
	radio.checked = true;
}
function selectbox(id)
{
	var box = document.getElementById(id);
	if(box.checked == false)
	{
		
	}
	else
	{
		
	}
}
function showdiv(id)
{
	var div = document.getElementById(id);
	if(div.style.display == "block")
	{
		div.style.display = 'none';
	}
	else
	{
		div.style.display = 'block';
	}
}
function removetext(id, text)
{
	var textfield = id;
	if(textfield.value == text)
	{
		textfield.value = "";
		textfield.style.color = "#000";
	}
}
function checktext(id, text)
{
	var textfield = id;
	if(textfield.value == "")
	{
		textfield.value = text;
		textfield.style.color = "#999";
	}
	else if(textfield.value == text)
	{
		textfield.style.color = "#999";
	}
	else
	{
		textfield.style.color = "#000";	
	}
}
function checktext2(id, text)
{
	var textfield = id;
	if(textfield.value == text)
	{
		textfield.style.color = "#999";
	}
	else
	{
		textfield.style.color = "#000";	
	}
}
function acceptterms(id, id2)
{
	var submitbutton = document.getElementById(id);
	var box = document.getElementById(id2);
	if(box.checked == true)
	{
		submitbutton.disabled = false;
	}
	else
	{
		submitbutton.disabled = true;	
	}
}

(function($) {
  $.fn.example = function(text, args) {
    var isCallback = $.isFunction(text);
    var options = $.extend({}, args, {example: text});
    return this.each(function() {
      var $this = $(this);
      if ($.metadata) {
        var o = $.extend({}, $.fn.example.defaults, $this.metadata(), options);
      } else {
        var o = $.extend({}, $.fn.example.defaults, options);
      }
      if (!$.fn.example.boundClassNames[o.className]) {
        $(window).unload(function() {
          $('.' + o.className).val('');
        });
        $('form').submit(function() {
          $(this).find('.' + o.className).val('');
        });
        $.fn.example.boundClassNames[o.className] = true;
      }
      if ($.browser.msie && !$this.attr('defaultValue') && (isCallback || $this.val() == o.example))
        $this.val('');
      if ($this.val() == '' && this != document.activeElement) {
        $this.addClass(o.className);
        $this.val(isCallback ? o.example.call(this) : o.example);
      }
      $this.focus(function() {
        if ($(this).is('.' + o.className)) {
          $(this).val('');
          $(this).removeClass(o.className);
        }
      });
      $this.change(function() {
        if ($(this).is('.' + o.className)) {
          $(this).removeClass(o.className);
        }
      });
      $this.blur(function() {
        if ($(this).val() == '') {
          $(this).addClass(o.className);
          $(this).val(isCallback ? o.example.call(this) : o.example);
        }
      });
    });
  };
  $.fn.example.defaults = {
    className: 'example'
  };
  $.fn.example.boundClassNames = [];
})(jQuery);
