var BrowserType
var Saved = 0;
//var PageAction;
function MM_checkBrowser() { //v4.0
  var app=navigator.appName
  if (app.indexOf('Netscape') != -1) {
    BrowserType = 'Netscape'
  } else if (app.indexOf('Microsoft') != -1) {
	BrowserType = 'Microsoft'
  } else {
	  BrowserType = 'UnKonwn'
  }
}
//MM_checkBrowser() ' For Default Execution

function SmallerGreaterDate(FirstDate, SecondDate){
	var FDate = new Date(FirstDate)
	var SDate = new Date(SecondDate)

	if (FDate < SDate) {
		return true; // Second  Date Is Greater
	}
	else{
		return false; // First Date Is Greater
	}
}

function datediff(Interval, StartDate, EndDate){
	var Result
	datDate2= Date.parse(StartDate); 
	datDate1= Date.parse(EndDate); 
	days = ((datDate1-datDate2)/(24*60*60*1000))
	if (Interval == 'y' || Interval == 'Y'){
		Result = days/365;
	}else if (Interval == 'm' || Interval == 'M'){
		Result = days/12;
	}
	else if (Interval == 'd' || Interval == 'D'){
		Result = days;
	}
	return Result;
}
function DisplayDiv(DivName){// To display div tags of the months
	//DivName.style.visibility = 'visible';
	document.getElementById(DivName).style.visibility = "visible";	
}
function HideDiv(DivName){// To Hide div tags of the months
	//DivName.style.visibility = 'hidden';
	document.getElementById(DivName).style.visibility = 'hidden';
}
function checkAllwithHighlight(field,element)
{
	var x = 0;
	if(element.checked == true){
		for (i = 0; i < field.length; i++){
			if (field[i].disabled == false){
				field[i].checked = true ;
			}
			if (x == 0) {x = 1} else { x=0}
			highlight_row(field[i],x);
		}
	} else {
		x = uncheckAll(field,element)
	}
}
function uncheckAll(field,element)
{
var x = 0;
	for (i = 0; i < field.length; i++){
		field[i].checked = false ;
		if (x == 0) {x = 1} else { x=0}
		highlight_row(field[i],x);
	}
}

function highlight_row(the_element,EvenOdeRow) {
	if(the_element.checked == true) {
		the_element.parentNode.parentNode.className = 'TdChecked';
	} 
	else {
		if (EvenOdeRow ==0) {
			the_element.parentNode.parentNode.className = 'TdUnchecked';
		}else{
			the_element.parentNode.parentNode.className = 'TdUnchecked2';
		}
	}
}


function Move_otherPage(CurrentPage ,frm, Action, SendTo){
	if (UserReadOnly == false){
		if (ValidatePagesData(CurrentPage,frm) == true){
			frm.method = "post";
			frm.action = Action
			frm.submit();
		}
	}else{
		window.location = SendTo
	}
}


function SelectPageFire(){
	document.form1.method = 'post';
	document.form1.Action = document.form1.CurrentPage.value
	//'Search_Claims.asp?Action=y&CurrentPage='+document.form1.CurrentPage.value
	document.form1.submit();
}
function NextPrevious_Page(PageNo){
	document.form1.CurrentPage.value = PageNo
	SelectPageFire();
}

function ShowChildWindow(theURL, width, height, scrollyn) { //v2.0
  //window.open(theURL,winName,features);
	leftPos = 0;
	topPos = 0;
	if (screen) {
		leftPos = ((screen.width - width )/ 2) 
		topPos = ((screen.height - height)/ 2) 
	} 
	win = open (theURL,'UploadImage','scrollbars='+scrollyn+',width='+width+',height='+height+',left='+leftPos+',top='+topPos);
	win.opener = top;
}


function ShowChildWindow_FullScreen(theURL, scrollyn) { //v2.0
  //window.open(theURL,winName,features);
	leftPos = 0;
	topPos = 0;
	if (screen) {
		leftPos = 0
		topPos = 0
	} 
	var h = screen.height - 90;
	win = open (theURL,'UploadImage','scrollbars='+scrollyn+',width='+screen.width+',height='+h+',left='+leftPos+',top='+topPos);
	win.opener = top;
}


function ReturnSelected(field,msg)
{
	var x = 0
	for (i = 0; i < field.length; i++){
		if (field[i].checked == true) {
			x = 1;
			return i;
		}
	}
	if (x==0){
		if (msg != ''){
			alert(msg);
		}
		return false;
	}
}

function SeletAllChecks(field,element)
{
	var x = 0;
	if(element.checked == true){
		for (i = 0; i < field.length; i++){
			if (field[i].disabled == false){
				field[i].checked = true ;
			}
			if (x == 0) {x = 1} else { x=0}
		}
	}else{
		x = UnSeletAllChecks(field,element)
	}
}
function UnSeletAllChecks(field,element)
{
var x = 0;
	for (i = 0; i < field.length; i++){
		field[i].checked = false ;
		if (x == 0) {x = 1} else { x=0}
	}
}

function FireSubmit(URL){
	document.form1.method = 'post';
	document.form1.action = URL
	document.form1.submit();
}
