// ===================================================================
//
//   Author: Ronny Schweitzer <ronny.schweitzer@gmx.de>
//
// ===================================================================
var todaysdate;

function newwin(kenn,file,X,Y,R,S,NC,P)
{
    var win;
    win = window.open (file,kenn,"alwaysLowered=0,alwaysRaised=0,channelmode=0,dependent=0,directories=0,fullscreen=0,hotkeys=1,location=0,menubar=0,resizable="+R+",scrollbars=1,status=1,titlebar=1,toolbar="+P+",z-lock=0,screenX=0,screenY=0,height="+X+",width="+Y);

    if (NC == 1){

       win.moveTo(0,0);
       win.resizeTo(screen.width,screen.height-28);

    }
    else
    if (NC == 2){

       win.moveTo(20,20);

    }
    else
    	       win.moveTo((screen.width/2)-(Y/2),(screen.height/2)-(X/2)-10);

	win.focus();
}
function win_close(kenn)
{
    var win;
    win = window.open('_blank',kenn);
    win.close();
}

function da(artnr){
	if (!confirm("Diesen Artikel wirklich löschen?")) return;
	document.main.del.value=artnr;
	document.main.submit();
}

function pt( formx, elmx )
  {
   pw = window.open("_blank","printtext","width=700,height=40,menubar=yes");
   pw.document.open("text/html");
   pw.document.write("<html>\n<head>\n<style>\nbody {color: black;font-size: 12px;font-family: Arial, Helvetica, SunSans-Regular, Geneva, Swiss;font-style: normal;border: 0px none; }\n");
   pw.document.write(".Ueberschrift {font-family: arial; color: black; font-weight: bold; font-size: 16px; }\n</style>\n</head>\n<body leftmargin=0 topmargin=0>\n");
   pw.document.write(document.forms[''+formx+''].elements[''+elmx+''].value);
   pw.document.write("</body></html>\n");
   pw.document.close();
   if(window.print){pw.print(); pw.close();}
   else{pw.alert("Seite muss manuell gedruckt werden.")}
}

function checkie() {

version = parseInt(navigator.userAgent.substr(navigator.userAgent.indexOf("MSIE")+5,1));
if (( navigator.userAgent.indexOf("MSIE") == 0 ) || (( navigator.userAgent.indexOf("MSIE") > 0 )&&(version < 5.5)))
	alert('Sie benötigen einen Internet Explorer ab der Version 5.5, um alle Funktionen von Artikelstar nutzen zu können. Sie können sich eine neue Version vom Internet Explorer bei www.microsoft.de kostenlos herunterladen.');

}

function radioWert(Obj) {
    for (var i=0; i<Obj.length; i++) if (Obj[i].checked) return Obj[i].value;
    return false;
}

function checkAll(opt) {
if (opt==1) if (document.main.checkall.checked == true) document.main.checkall.checked = false; else document.main.checkall.checked = true;
	if (document.main.checkall.checked == true) what = true; else what = false;
	for (i = 0; i < document.main.length; i++) if (document.main[i].type == 'checkbox') document.main[i].checked = what;
}

function setkon (val) {
	document.main.kon.value=val;document.main.pos.value=0;document.main.submit();
}
function setmail (val) {
	document.main.msgnr.value=val;document.main.submit();
}
function vc(sid, uid) { newwin('viewcon','../inc/viewcontact.php?sid='+sid+'&uid='+uid,'506','610',0,0,0); }

function refreshHead(elementName, text)
{
	var theElement = document.getElementById( elementName );
	if(theElement != null )
	{
		theElement.innerHTML = text;
	}

}


function confirmDelete()
{

	if (! confirm("Soll der Datensatz wirklich gel\u00F6scht werden?\n"))
	{
		return false;
	}

	return true;
}
