function admin_delete(){
	return confirm("Are sure you want to delete this record?");
}

function setRowColor(rowID, state){
	var row = document.getElementById(rowID);
	var out;
	//alert(out)
	/*
	for (key in row){
		out += key +" ";
	}
	alert(out);
	*/
	//alert(rowID);
	if (state) {
		
		row.className = "selected";
	} else {
		row.className = "";
	}
	
}

function setSelectArray(itemID, selectID){
	selectID = (selectID) ? selectID : 'select_array' ;
	var form = document.forms[0];
	var flatArr = form[selectID].value;
	var selectArr = flatArr.split(":");
	var removed;
	
	//alert(selectID);
	for (key in selectArr){
		if (selectArr[key] == itemID){
			removed = selectArr.splice(key,1);
		}
	}
	
	if (!removed){
		selectArr.push(itemID);
	}
	form[selectID].value = selectArr.join(":");
	return !removed;
}

function resetBackground(){
	var top, left;
	var body = document.body;
	
	test = 0;
	if (window.innerHeight){
		height =  window.innerHeight;
	} else if(document.documentElement.clientHeight){
		height =  document.documentElement.clientHeight;
	} else {
		height =  document.body.clientHeight;
	}
	
	//alert(test);
	if (body){
		top = (height - 629) + "px";
		left = ((body.clientWidth/2) - (1506/2)) + "px";
		var out;
		for ( key in window){
			if (key.substr(0,1) == "d"){
				out += key + ": " + window[key]+ "\n";
			}
			
		}
	//alert(document.documentElement.clientHeight);
		//alert (left + " " + top);
		body.style.backgroundPosition = left + " " + top;
		//body.style.backgroundPositionX = left;
		//body.style.backgroundPositionY = top;
		
	}
}

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
}

function resetVertical(objHeight){
	var obj, objName, height, errorBoxHeight;
	if (objHeight ) {
		//alert(document.body.clientHeight);
		for (objName in objHeight) {
			if(document.getElementById(objName) != null) {
				obj = document.getElementById(objName);

				if(document.getElementById("error_box") != null) {
					errorBox = document.getElementById("error_box")
					errorBoxHeight = errorBox.offsetHeight+ errorBox.style.marginTop + errorBox.style.marginBottom;
				}else{
					errorBoxHeight =0 ;
				}

				if(document.getElementById("info_box") != null) {
					infoBox = document.getElementById("info_box")
					infoBoxHeight = infoBox.offsetHeight + infoBox.style.marginTop + infoBox.style.marginBottom;
				}else{
					infoBoxHeight =0 ;
				}

				//alert(errorBox);
				height = document.body.clientHeight - objHeight[objName] - errorBoxHeight - infoBoxHeight;
				//if (height < objHeight[1]) {height = objHeight[1];}
				if (height < 40) {height = 40;}
				//alert(objName+' '+height);
				obj.style.height = height + "px";
			}
		}
	}
}

function toggle_day(date){
	day = document.getElementById('day_' + date);
	if (day.value == 1 ) {
		day.value = 0;
	} else {
		day.value = 1 ;
	}
	
	block = document.getElementById('block_' + date);
	if (day.value == 1 ) {
		block.style.background = "#c6c6c6";
	} else {
		block.style.background = "#fff";
	}
}