function newWindow(windowPath, windowName, width, height) 
{
	window.open(windowPath,windowName,'width='+width+',height='+height+',left=100,top=100,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');
}

	function makeShow(idBlock, idElement, object) {
		var left = getAbsoluteLeft(idElement);
		var top = getAbsoluteTop(idElement);

		if ($.browser.safari || $.browser.opera){
			if(object) {
				hideAll();
			}
			var array = findPosition(object);
			var left = array[0];
			var top = array[1];		
		}
		
		var div = document.getElementById(idBlock);
		var elem = document.getElementById(idElement);
		
		//menu for superflous
		if(idElement == 'SUPERFLUOUS-DIV') {
			$(div).css({top:top+50,left:left-600+105,display:"block", width:"600px"});
		} else if(idElement == 'E-COMMERCE-DIV') {
			$(div).css({top:top+50,left:left-600+88,display:"block", width:"600px"});
		} else if(idElement == 'MY-ACCOUNT-DIV') {
			$(div).css({top:top+50,left:left-600+91,display:"block", width:"600px"});
		}
		else {
			$(div).css({top:top+50,left:left,display:"block"});
		}
		
	//	hideControls(idElement);
		
	}
	function hideControl(name) {
		$('input[@name='+name+']').hide();
		$('select[@name='+name+']').css('visibility','hidden');
	}
	function showControl(name) {
		$('input[@name='+name+']').show();
		$('select[@name='+name+']').css('visibility','visible');
	}
	function makeHide(id) {
		if(!$.browser.safari) {
			document.getElementById(id).style.display="none";
			showControl('category');
			showControl('year');     
	
		}
	}
	
	
	
	function hideAll() {
		document.getElementById('ANNOUNCEMENTS-MENU').style.display="none";
		document.getElementById('DIRECTORY-MENU').style.display="none";
		document.getElementById('ATHLETICS-MENU').style.display="none";
		document.getElementById('SUPERFLUOUS-MENU').style.display="none";
		document.getElementById('E-COMMERCE-MENU').style.display="none";
		document.getElementById('MY-ACCOUNT-MENU').style.display="none";
	}
	
	function getElementWidth(objectId) {
		x = document.getElementById(objectId);
		return x.offsetWidth;
	}


	function findPosition( oElement ) {
		if( typeof( oElement.offsetParent ) != 'undefined' ) {
			var oTop = oElement.offsetTop;
			var oLeft = oElement.offsetLeft;
			while(oElement.offsetParent!=null) { // Parse the parent hierarchy up to the document element
				oElement = oElement.offsetParent // Get parent object reference
				oTop += oElement.offsetTop // Add parent top position
				oLeft += oElement.offsetLeft // Add parent top position
			}   
			return [ oLeft, oTop ];
		} else {
			return [ oElement.x, oElement.y ];
		}
	}
	function getAbsoluteLeft(objectId) {
		// Get an object left position from the upper left viewport corner
		o = document.getElementById(objectId)
		oLeft = o.offsetLeft // Get left position from the parent object
		while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
			oParent = o.offsetParent // Get parent object reference
			oLeft += oParent.offsetLeft // Add parent left position
			o = oParent
		}
		
		return oLeft
	}
	
	
	function getAbsoluteTop(objectId) {
		// Get an object top position from the upper left viewport corner
		o = document.getElementById(objectId)
		oTop = o.offsetTop // Get top position from the parent object
		while(o.offsetParent!=null) { // Parse the parent hierarchy up to the document element
			oParent = o.offsetParent // Get parent object reference
			oTop += oParent.offsetTop // Add parent top position
			o = oParent
		}
		return oTop
	}

	function getElementLeftTop(idElement, object) {
		var left = getAbsoluteLeft(idElement);
		var top = getAbsoluteTop(idElement);

		if ($.browser.safari || $.browser.opera){
			var array = findPosition(object);
			var left = array[0];
			var top = array[1];		
		}
		
		return [left, top]
	}
	
	function go(name)
	{
		box = document.multimedia_form[name];
		destination = box.options[box.selectedIndex].value;
		if (destination) location.href = destination;
	}	
	function getInput(input) {
		//alert(input.value.length);
		if(input.value.length == 4) {
			input.form.action="/athletics/"+input.value+'/';
			input.form.submit();
		}
		return true;
	}
	
	
	function bind_year_to_ac(year_field, ac_field) {
		if ($('#'+year_field).val() >= 1600) {
			$('#'+ac_field).setOptions({extraParams:{year:$('#'+year_field).val()}})
		}
	}
	
	
	function makeMediaFolderDivWidth() {
		var width = getElementWidth('group-media-table');
		$('#group-media-folders-container').width(width-40);
	}
	
	/*function delConfirm(url) {
		if (window.confirm("Are you sure you want to delete this?")) {
			if($.get(url)) {
				window.location.reload();
			} else {
				 need to fix this 
				alert('You can\'t delete this.');
			}
			
		}
	}*/
		
	function delConfirm(url) {
		if (window.confirm("Are you sure you want to delete this?")) {
			$.get(url, function(data){
        if (data) {
          window.location.reload(); 
        } else {
          /* need to fix this */
          alert('You can\'t delete this.');
        }
      });
			
	
	 }
	}
	
	
	function confirmDelete() {
		if(window.confirm("Are you sure you want to delete this?")) {
			return true;
		} else {
			return false;
		}
	}

	function disableEnterKey(e)
	{
		var key;     
		if(window.event)
			key = window.event.keyCode; //IE
		else
			key = e.which; //firefox     
	
		return (key != 13);
	}	
