function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
function popupPage(theurl) {
    if (document.all)
        var xMax = screen.width, yMax = screen.height;
    else
        if (document.layers)
            var xMax = window.outerWidth, yMax = window.outerHeight;
        else
            var xMax = 200, yMax=200;

    var xOffset = (xMax - 450)/2, yOffset = (yMax - 200)/2;

    window.open(theurl,'my','location=No,scrollbars=Yes,menubar=No,toolbar=No,resizable=No,width=550,height=300,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'');
}
function poplibrary(theurl) {
var windowprops = "location=no,scrollbars=yes,menubar=no,toolbar=no,resizable=Yes" +
",left=" + 480 + ",top=" + 100 + ",width=" + 500 + ",height=" + 400;

var URL = theurl;

popup = window.open(URL,"MenuPopup",windowprops);
}

function dc(tloc)
{
location.href = tloc;
}

function doDisplay() {
location.href="varticles.asp"
}

function dopendel(ai) {
mmstr = "Delete the pending article "+ai+ " ?";
if (confirm(mmstr))
{
var tmp = "UpdateEvents.asp?Actionvar=Delete&name_id="+ai;
location.href=tmp;
}
}

function delpage(ai,num,durl,vtype) {
mmstr = "Delete page "+ num+" of article "+ai+ " ?";
	if (confirm(mmstr))
	{
	if (vtype=="1")
	{
		if(newConfirm("WEBDynamiQ","Archive old article and save edited one?",1,1,0))
		{   
		durl = durl + "&isarchive=Y";	
		}
	}
		location.href=durl;
	}
}
function DoDelete(param, variable, num)
	{
		if (confirm("Do you want to permanently delete "+variable+": " + num + "?"))
			window.location = param ;
	}
	
function DoPost(param,num)
	{
	if (confirm("Do you want to POST record ref # " + num + "?"))
		window.location = param ;
	}

	
function DoReg(param,num)
	{
	if (confirm("Create account to this record # " + num + "?"))
		window.location = param ;
	}
function delvar(dcode,param,num)
	{
	var codestr;
	if (dcode == "1")
		codestr = "Do you want to remove this image:"+ num +"?"
	else if  (dcode == "2")
		codestr = "Do you want to remove this CV:"+ num +"?"
	else
		codestr = "Do you want to remove this item:"+ num +"?"
		
	if (confirm(codestr))
		window.location = param ;
}
	

function expandcontract(tbodyid,ClickIcon) {
if (document.getElementById(ClickIcon).innerHTML == "Show"){
document.getElementById(tbodyid).style.display = "";
document.getElementById(ClickIcon).innerHTML = "Hide";
} else {
document.getElementById(tbodyid).style.display = "none";
document.getElementById(ClickIcon).innerHTML = "Show";
}
}

function reloadpar()
{
	window.opener.location.reload(); 
	window.close();
}
function passtru(tbl,el,dv)
{
	document.forms[tbl].elements[el].value=dv;
}

function surfto(form) {
	var myindex=form.dest.selectedIndex
	location=form.dest.options[myindex].value;
}

function addthumbnail(fld,floc) {
	var newWindow;
	var props = 'scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,width=500,height=500,top=100,left=200';
	newWindow = window.open('\/elearn\/cms\/justlist.asp?floc='+ floc +'&fld='+fld, 'Upload_Images_to_server', props);
}
function uploadMenuImg(fld,floc) {
	var newWindow;
	var props = 'scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,width=500,height=500,top=100,left=200';
	newWindow = window.open('\/elearn\/cms\/LOAD_MEDIA.asp?floc='+ floc +'&fld='+fld, 'Upload_Images_to_server', props);
}


function InsMedia(fldval,str,fldtyp,floc)
{

	if (floc == "B")
		document.forms["editor"].elements[fldval].value = str;
	else
	{
	if (fldtyp == "M")
		document.forms["editor"].AN_MEDIATY[0].checked = true;
	else
		document.forms["editor"].AN_MEDIATY[1].checked = true;
		
		document.forms["editor"].elements[fldval].value = str;
	}
}
function chkpassword(frm)
{

	if (frm.FLD_usrPWD.value!=frm.FLD_usrPWD2.value)
	{
		alert("Password and confirm password do not match!")
		return false;
	}
	else
		return true;
}
function DoConfirm(type,item_type,id)
{
	window.location ='confirm_notify.asp?atype='+type+'&item='+item_type+'&ID='+id ;
}
function Goto(param)
{
	window.location =param;
}
function Mailto(atype,item_type,email)
{
	window.location='notify_email.asp?atype='+atype+'&item_type='+item_type+'&email='+email;
}


// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or
// private, without any further permission from the author. You may
// remove this notice from your final code if you wish, however it is
// appreciated by the author if at least my web site address is kept.
//
// You may *NOT* re-distribute this code in any way except through its
// use. That means, you can include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download. 
// If you wish to share this code with others, please just point them
// to the URL instead.
// Please DO NOT link directly to my .js files from your site. Copy
// the files to your server and use them there. Thank you.
// ===================================================================





