function ShowProgress()
{
  strAppVersion = navigator.appVersion;
  if (document.articleForm.imageSrc_file.value != "" )
  {
    if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
    {
      winstyle = "dialogWidth=385px; dialogHeight:140px; center:yes";
      window.showModelessDialog('<% = barref %>&b=IE',null,winstyle);
    }
    else
    {
      window.open('<% = barref %>&b=NN','','width=370,height=115', true);
    }
  }
  return true;
}

function extractFilename( src, end ) {
	if( ((eval(src).value).indexOf( "\\" ) != -1) && ((eval(src).value).indexOf( "\\" ) < eval(src).value.length) )
	eval( end ).value = (eval( src ).value).substring( (eval( src ).value).lastIndexOf( "\\" ) + 1 );
}

function appendField( obj, txt ) {
	obj.value+=txt;
}

function Hide(id){

	var d = window.document.all;
	for (var i = 0; i < d.length; i++)
	{
		
		if (d[i].id==id)
		{
			d[i].style.display="none";
			d[i].style.visibility="hidden";
		}
	
	}
	//ChangeBGColor();
}

function show( id ){
	obj= document.getElementById(id);
	obj.style.display = "block";
	obj.style.visibility="visible";
}

function setMod( frm, tbl, pkCol, pkVal, col, val, act ) {
	frm.tbl.value = tbl;
	frm.pkCol.value = pkCol;
	frm.pkVal.value = pkVal;
	frm.col.value = col;
	frm.val.value = val;
	frm.act.value = act;
}


//------------------------ Message Code ------------------------------- Start --
function ConfirmDelete(){
	var x=window.confirm("Are you sure you want to delete this item?");
	if (x) return true;
	else return false;
}

function ConfirmUpdate(){
	var x=window.confirm("Are you sure you want to update this item?");
	if (x) return true;
	else return false;
}

function ConfirmVisibleUpdate(){
	var x=window.confirm("This will change Live Site content. Are you sure you want to do this?");
	if (x) return true;
	else return false;
}
//------------------------ Message Code ------------------------------- End --

//------------------------ ValiDATE ------------------------------- Start --
function check_date(field){
var checkstr = "0123456789";
var DateField = field;
var Datevalue = "";
var DateTemp = "";
var seperator = ".";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var i;
   err = 0;
   DateValue = DateField.value;

   for (i = 0; i < DateValue.length; i++) {
	  if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
	     DateTemp = DateTemp + DateValue.substr(i,1);
	  }
   }
   DateValue = DateTemp;

   if (DateValue.length == 6) {
      DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
   if (DateValue.length != 8) {
      err = 19;}
 
   year = DateValue.substr(4,4);
   if (year == 0) {
      err = 20;
   }
 
   month = DateValue.substr(2,2);
   if ((month < 1) || (month > 12)) {
      err = 21;
   }
 
   day = DateValue.substr(0,2);
   if (day < 1) {
     err = 22;
   }
 
   if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
      leap = 1;
   }
   if ((month == 2) && (leap == 1) && (day > 29)) {
      err = 23;
   }
   if ((month == 2) && (leap != 1) && (day > 28)) {
      err = 24;
   }
 
   if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
      err = 25;
   }
   if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
      err = 26;
   }
 
   if ((day == 0) && (month == 0) && (year == 00)) {
      err = 0; day = ""; month = ""; year = ""; seperator = "";
   }
   
   if (err == 0) {
      DateField.value = day + seperator + month + seperator + year;
	return true;
   }
 
   else {
	return false;
   }
}

//------------------------ ValiDATE ------------------------------- End --

function pdfCheck( field ){
	var err = 0;
	
	if( field.value != "" ){
		if( field.value.indexOf( ".pdf") == -1 ){
			err = -1
		}
	}
		
	if( err != 0 ) {
		alert("File does not appear to be a valid PDF document.");
		field.style.border = "1px solid #FF0000";
	return false;
	}
	else {
		field.style.border = "1px solid #bcc6da";
		return true
	}
}

function imageCheck( _img, maxWidth, maxHeight ){
	var image = new Image();
	image.src = _img.value;
	if( _img.value=="" )
		return true;
	
	if( ((_img.value.toLowerCase()).indexOf( ".gif" ) != -1) || ((_img.value.toLowerCase()).indexOf( ".jpg" ) != -1) || ((_img.value.toLowerCase()).indexOf( ".bmp" ) != -1) || ((_img.value.toLowerCase()).indexOf( ".png" ) != -1) ){
		if( maxWidth!='0' || maxHeight!=0){
			if( parseInt(image.width) > maxWidth || parseInt(image.height) > maxHeight ) {
				alert ( "Incorrent image dimensions . The recommended image dimensions are width: " + maxWidth + " height:" + maxHeight + "." );
				_img.style.border = "1px solid #FF0000";
				return false;
			}
		}
	}
	else{
		alert ( "Incorrect image format. Formats recommended for web use are .gif, .jpg and .png" );
		return false;
	}
	_img.style.border = "1px solid #bcc6da";
	return true;
}

function launchimg(image) 
{
	file = "/script_library/popup.htm?"+image;
	var width = 500;
	var height = 500;
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	window.open(file,"","Width="+width+",height="+height+",top="+top+",left="+left+", RESIZABLE=0,TOOLBAR=0,DIRECTORIES=0,STATUS=0,MENUBAR=0,SCROLLBARS=0,COPYHISTORY=0");
}

function maskKeyPress(objEvent) {
	var iKeyCode;

	if( ((objEvent.charCode) == null) || ( objEvent.charCode == "undefined" ) )
		iKeyCode = objEvent.keyCode;
	else
		iKeyCode = objEvent.charCode;

	if(iKeyCode>=48 && iKeyCode<=57) return true;
	return false;
}