//##############################################################################
// NewWindow
var win=null;

function NewWindow(mypage,myname,w,h,scroll,pos){

    if(pos=="random"){
        LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
    }
    if(pos=="center"){
        LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
    }
    else if((pos!="center" && pos!="random") || pos==null){
        LeftPosition=0;TopPosition=20
    }
    settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
    win=window.open(mypage,myname,settings);
    win.focus();
}
//##############################################################################
// Progress Window
var progress_window;
function open_progress_window(caption) {
 progress_window = window.open("progress.php?caption=" + caption, "progress_window", "width=350, height=120, menubar=no, statusbar=no, toolbar=no");
}

function close_progress_window() {
         if (progress_window != null) {
                 progress_window.close();
         }
}
//##############################################################################
// Drop File
function dropFile()
{
    if (confirm ("Do you want to delete this file irrevocablly?") == true){
        return true;
    }
    else
        return false;
}
//##############################################################################
function refresh( target)
	 {
		 if (target.name == 'dd_name')
			 document.dd_name.submit()
		 if (target.name == 'dd_tribute'){
             document.dd_tribute.submit()
         }
		 if (target.name == 'dd_rubric'){
			 document.dd_rubric.submit()
         }
     }
//###############################################################################
// Counter bei Eingabe der Beschreibung

function CheckLen(Target, maxLen) {

	StrLen = Target.value.length
	if (StrLen == 1 && Target.value.substring(0,1) == " ") {
		Target.value = ""
        StrLen = 0
	}
	if (StrLen > maxLen ) {
		Target.value = Target.value.substring(0,(MaxLen-1))
		CharsLeft = 0
	}
	else {
    	CharsLeft = maxLen - StrLen
	}
	document.Main.Anzahl.value = CharsLeft
}

