function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function chkDeleteRecord(id) {
	if ( ! confirm("Delete ID = "+id+" ?") )	 {
		return false;
	}
	return true;
}

function chkDelete(frm){
		if ( ! confirm("Delete  records ?") )
      {
		}else{
			tmpDel="";
			if(frm.checkbox.length>0){
				for(i=0;i<frm.checkbox.length;i++){
						if(frm.checkbox[i].checked==true){
							tmpDel+=frm.checkbox[i].value+",";
						}
				}
			}else{
				if(frm.checkbox.checked==true){
					tmpDel+=frm.checkbox.value+",";
				}
			}

			tmpDel;
			frm.	delValue.value=tmpDel;
			frm.action="delete.php";
			frm.submit();
		}

	return false;
}



function checkDelete(oCheckbox){
	if(oCheckbox.checked==true){
		oCheckbox.parentElement.parentElement.style.backgroundColor='#FFDDDD';
	}else{
		oCheckbox.parentElement.parentElement.style.backgroundColor='';
	}
}
function checkAllDelete(oAllCheckBox,frm){
	for(i=0;i<frm.elements.length;i++){
		if((frm.elements[i].type == "checkbox")&&(frm.elements[i] != oAllCheckBox)){
			if(oAllCheckBox.checked==true){
				frm.elements[i].parentElement.parentElement.style.backgroundColor='#FFDDDD';
				frm.elements[i].checked=true;
			}else{
				frm.elements[i].parentElement.parentElement.style.backgroundColor='';			
				frm.elements[i].checked=false;			
			}
		}
	}
}

function goPage(rP){
	var frmSearch=document.frmSearch;
	frmSearch.rP.value=rP;
	frmSearch.submit();
}
function swImage(sNumber,id){
	var srcImage;
	srcImage=document.frm["Picture"+sNumber].value;
	document[id].src='file:///'+srcImage;
}
function deletePic(FieldName,ObjectID,FileFullName){
		if ( ! confirm("Delete a picture?") )
      {
		}else{
			window.location.href="deletePicture.php?ObjectID="+ObjectID+"&FieldName="+FieldName+"&FileFullName="+FileFullName;
		}	
}
function deletePic2(FieldName,MainID,ObjectID,FileFullName){
		if ( ! confirm("Delete a picture?") )
      {
		}else{
			window.location.href="deletePicture2.php?MainID="+MainID+"&ObjectID="+ObjectID+"&FieldName="+FieldName+"&FileFullName="+FileFullName;
		}	
}

function Map()
{
    // members
    this.keyArray = new Array(); // Keys
    this.valArray = new Array(); // Values
        
    // methods
    this.put = put;
    this.get = get;
    this.size = size;  
    this.clear = clear;
    this.keySet = keySet;
    this.valSet = valSet;
    this.showMe = showMe;   // returns a string with all keys and values in map.
    this.findIt = findIt;
    this.remove = remove;
}

function put( key, val )
{
    var elementIndex = this.findIt( key );
    
    if( elementIndex == (-1) )
    {
        this.keyArray.push( key );
        this.valArray.push( val );
    }
    else
    {
        this.valArray[ elementIndex ] = val;
    }
}

function get( key )
{
    var result = null;
    var elementIndex = this.findIt( key );

    if( elementIndex != (-1) )
    {   
        result = this.valArray[ elementIndex ];
    }  
    
    return result;
}

function remove( key )
{
    var result = null;
    var elementIndex = this.findIt( key );

    if( elementIndex != (-1) )
    {
        this.keyArray = this.keyArray.removeAt(elementIndex);
        this.valArray = this.valArray.removeAt(elementIndex);
    }  
    
    return ;
}

function size()
{
    return (this.keyArray.length);  
}

function clear()
{
    for( var i = 0; i < this.keyArray.length; i++ )
    {
        this.keyArray.pop(); this.valArray.pop();   
    }
}

function keySet()
{
    return (this.keyArray);
}

function valSet()
{
    return (this.valArray);   
}

function showMe()
{
    var result = "";
    
    for( var i = 0; i < this.keyArray.length; i++ )
    {
        result += "Key: " + this.keyArray[ i ] + "\tValues: " + this.valArray[ i ] + "\n";
    }
    return result;
}

function findIt( key )
{
    var result = (-1);

    for( var i = 0; i < this.keyArray.length; i++ )
    {
        if( this.keyArray[ i ] == key )
        {
            result = i;
            break;
        }
    }
    return result;
}

function removeAt( index )
{
  var part1 = this.slice( 0, index);
  var part2 = this.slice( index+1 );

  return( part1.concat( part2 ) );
}
Array.prototype.removeAt = removeAt;

var urlOld	="http://localhost/tclub/";
var urlNew="../";
var urlBO		="http://localhost/tclub/tadmin/";
