//<!--
/*************************************************************************************/
/***	Checks/unchecks all tables
*		@param   string   the form name
*		@param   boolean  whether to check or to uncheck the element
*		@return  boolean  always true
***/
function setCheckboxes(the_form, do_check){
	var elts      = document.forms[the_form].elements['selected_row[]'];
	var elts_cnt  = elts.length;
	for (var i = 0; i < elts_cnt; i++) {
		elts[i].checked = do_check;
	} // end for
	return true;
} // end of the 'setCheckboxes()' function

/*************************************************************************************/

function CheckAll(checked) {
    len = document.docs_form.elements.length;
    var i;
    for (i=0; i < len; i++) {
        if (document.docs_form.elements[i].name=='selected_row[]') {
            document.docs_form.elements[i].checked=checked;
        }
    }
}

/********************************************************************************/

function duplicates (the_form){
	var do_check= document.forms[the_form].CheckPhotographer.checked;
	var elts = document.forms[the_form].TotalPhoto.value;
	if(do_check == 1){
		for(var i=1; i <=elts; i++){
			alert ("true");
			// document.forms[the_form].PhotoSequence[2].value="same";
		}
	} else {
		//alert ("false");
	}
	return true;
}

/********************************************************************************/

// change color upon selection
function setPointer(theRow, thePointerColor){
	if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
		return false;
	}
	if (typeof(document.getElementsByTagName) != 'undefined') {
		var theCells = theRow.getElementsByTagName('td');

	} else if (typeof(theRow.cells) != 'undefined') {
		var theCells = theRow.cells;

	} else {
		return false;
	}

	var rowCellsCnt  = theCells.length;
	for (var c = 0; c < rowCellsCnt; c++) {
		theCells[c].style.backgroundColor = thePointerColor;
	}
	return true;
} // end of the 'setPointer()' function


function setPointer1(theRow, thePointerColor){
	if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
		//alert("1");
		return false;
	}
	if (typeof(document.getElementsByTagName) != 'undefined') {
		var theCells = theRow.getElementsByTagName('td');
		theRow.style.backgroundColor = thePointerColor;
		//alert("2");
	} else if (typeof(theRow.cells) != 'undefined') {
		var theCells = theRow.cells;
		//alert("3");
	} else {
		//alert("4");
		return false;
	}
	return true;
} // end of the 'setPointer1()' function

function reloads(form){
	var index1=form.DocCategoryId.selectedIndex;
	var url='./admin.php?d=admin&p=keydoc&DocCategoryId='+form.DocCategoryId.options[index1].value
	//		+'&check=1'
	location.href=url;
	//alert(url);
}

function reloads2(form){
	var index1=form.InterviewCategoryId.selectedIndex;
	var url='./admin.php?d=admin&p=interview&InterviewCategoryId='+form.InterviewCategoryId.options[index1].value
	//		+'&check=1'
	location.href=url;
	//alert(url);
}

function reloads3(form){
	var index1=form.EssayCategoryId.selectedIndex;
	var index2=form.Active.selectedIndex;
	var index3=form.EssayType.selectedIndex;
	var url='./admin.php?d=admin&p=essay&mode=add&EssayCategoryId='+form.EssayCategoryId.options[index1].value
			+'&Active='+form.Active.options[index2].value
			+'&EssayType='+form.EssayType.options[index3].value
			+'&PostedDate='+form.PostedDate.value
			+'&EssayTitle='+form.EssayTitle.value
			+'&TotalPhoto='+form.TotalPhoto.value
			+'&=1'
	location.href=url;
}

function reloads4(form){

	var url='./admin.php?d=admin&p=essay&mode=addnew'
			+'&EssayId='+form.EssayId.value
			+'&TotalPhoto='+form.TotalPhoto.value
			+'&flg=1'
	location.href=url;
}

function datas1(form){
	var index1=form.directory.selectedIndex;
	var index2=form.page.selectedIndex;
	var index3=form.languageid.selectedIndex;
	var url='./data.php?directory='+form.directory.options[index1].value
			+'&page='+form.page.options[index2].value
			+'&languageid='+form.languageid.options[index3].value
			+'&check=1'
	location.href=url;
}

/*************************************************************************************/
function confirmLink(theLink)
{
    // Confirmation is not required in the configuration file
//    if (confirmMsg == '') {
//      return true;
//    }

    var is_confirmed = confirm('Do You Really want to DELETE this record?\n\nThis will permanently delete the Record!');
    if (is_confirmed) {
        theLink.href += '';
    }
    return is_confirmed;
} // end of the 'confirmLink()' function
/******************************************************************************************************/
// -->