/*
 
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 +                                                           + 
 +            TRAFIKWEB                                      +
 +                                                           +
 +   Filename: tw.js                                         +
 +                                                           +
 +   Funktion: JAVASCRIPT FUNKTIONEN                         +
 +                                                           +
 +    Version: 1.1                                           +
 +    Datum:   16.12.2003                                    +
 +    Author:  Simon Traber               			             +
 +    Doku:    -                                             +
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



*/

function WndTyp1(dieurl){
Typ1W=window.open(dieurl,"Typ1"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=400");
Typ1W.focus(); 
}

function WndTyp3(dieurl){
Typ1W=window.open(dieurl,"Typ1"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=780,height=580");
Typ1W.focus(); 
}

function WndTyp2(dieurl){
Typ2W=window.open(dieurl,"Typ2"," toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=350,height=240");
Typ2W.focus(); 
}


function ModSlideshowWndX(){

check = confirm("!!ACHTUNG!!\n Das Slideshow Modul wird im Vollbildmodus angezeit,\ndiesen koennen Sie nur mit der Tastenkombination ALT+F4 verlassen");
    if (check == false)
    { 
    return false;
    }
    else{
    dieurl='../slideshow/';

ModSlideshow=window.open(dieurl,"slideshow","fullscreen=yes, scrollbars=no");
ModSlideshow.focus(); 
    }

}
function noclick() {
    if (event.button==2) {
    alert("Hier wird nichts kopiert");
    }
   }

   // <body onMousedown="noclick()">

function numericTest(value)
{
	// von Veikko Wuensche
	for (var k=0; k < value.length; k++)
	{
   	var ch = value.substring(k,k+1);
      if ( ch < "0" || ch > "9")
		{
      	return 1;
      }
	}
	return 0;
}

function dznv(dieurl){
alert ("DERZEIT NICHT VERFUEGBAR");

}

function ModSlideshowWnd(){

check = confirm("!!ACHTUNG!!\n Das Slideshow Modul wird im Vollbildmodus angezeit,\ndiesen koennen Sie nur mit der Tastenkombination ALT+F4 verlassen");
    if (check == false)
    { 
    return false;
    }
    else{
    dieurl='slideshow/';

ModSlideshow=window.open(dieurl,"slideshow","fullscreen=yes, scrollbars=no");
ModSlideshow.focus(); 
    }



}

function ExcelWnd(){
ExcelW=window.open('export_excel.php',"Beleg"," toolbar=0,location=0,status=1,menubar=1,scrollbars=1,resizable=1,width=400,height=500");
ExcelW.focus(); 
}

function DokuWnd(durl){
DokuW=window.open(durl,"Doku"," toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=1,width=400,height=500");
DokuW.focus(); 
}

function ModTSArtInfo(BstId){

//dURL='http://devpoint.dls.at/Dev/TrafikwebVersions/DEVELOPMENT/module/trafistore/includes/view_artdetail.php?BID='+BstId;
dURL='http://trafikantenportal.trafikweb.at/module/trafistore/includes/view_artdetail.php?BID='+BstId;

ArtInfo=window.open(dURL,"ArtInfo"," toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=1,width=530,height=500");
ArtInfo.focus(); 
}

function BelegWnd(dieurl){
Beleg=window.open(dieurl,"Beleg"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=400,height=500");
Beleg.focus(); 
}

function HistoryWnd(dieurl){
HistW=window.open(dieurl,"History"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=700,height=450");
HistW.focus(); 
}

function BannerWnd(nr,wx,hx){

erwstr='toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=';
erwstr=erwstr+wx+',height='+hx;

BannerW=window.open("Data/banner/bannerclick.php?bannerid="+nr,"Banner",erwstr);
BannerW.focus(); 
}

function TrafistoreWnd(dieurl){
TrafistoreW=window.open(dieurl,"Trafistore"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=400");
TrafistoreW.focus(); 
}



function CockpitWnd(){
Cockpit=window.open("cockpit/index.php","Cockpit"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=450,height=420,dependent=yes");
                 Cockpit.moveTo(screen.width-420,20);
                 Cockpit.focus(); 
}

function CommunityWnd(){
Community=window.open('http://community.trafikweb.at',"TWCommunity"," toolbar=1,location=1,status=1,menubar=1,scrollbars=1,resizable=1,width=600,height=500");
Community.focus(); 
}

function RegisterPresspointWnd(){
RegisterPresspoint=window.open('register.php',"RegistrierungPresspoint"," toolbar=0,location=0,status=1,menubar=0,scrollbars=0,resizable=0,width=600,height=500");
RegisterPresspoint.focus(); 
}

// Artikeldetailfenster anzeigen
// Aenderung 20.9.09 (Hammer): Fenster ca. so hoch wie Bildschirmhoehe
function FolDetWnd(dieurl)
{
	var fensterbreite = 490;
	var hoehe = screen.availHeight - 150; // pauschal 150px abziehen
	//var xPos = (screen.availWidth / 2) - (1 / 2) * fensterbreite; // Fenster zentrieren

	//FolDet=window.open(dieurl,"ArtikelDetails"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+fensterbreite+",height="+hoehe+",screenX="+xPos); // vorher fixe Hoehe 550px

	FolDet=window.open(dieurl,"ArtikelDetails"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+fensterbreite+",height="+hoehe);

        FolDet.moveTo(screen.width-fensterbreite,0); // rechtsbuendig setzen

	//FolDet.moveTo(screen.availWidth-490,0);

	FolDet.focus();

}

function SchwWnd(dieurl){

SchwDet=window.open(dieurl,"Schwund"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=500,height=310");
                 
                 SchwDet.moveTo(screen.width-600,0);
                 SchwDet.focus(); 

}

function VzremWnd(dieurl){

VzremDet=window.open(dieurl,"VorzeitigeRetouren"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=650,height=310");
                 
                 VzremDet.moveTo(-650,0);
                 VzremDet.focus(); 

}

function FolVkWnd(ArtId){

FolVk=window.open("folvk.php?ArtikelId="+ArtId,"ArtikelVk"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=320,height=300");
                 
                 FolVk.moveTo(screen.width-490,0);
                 FolVk.focus(); 

}

function FeedbackWnd(dieurl){

if (dieurl == null)
	dieurl = 'feedback.php';

FBDet=window.open(dieurl,"FeedbackDetails"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=640,height=480");
FBDet.focus(); 

}
function TSFeedbackWnd(){

FBDet=window.open('../../feedback.php',"FeedbackDetails"," toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=640,height=480");
FBDet.moveTo(screen.width-640,0);
FBDet.focus(); 

}


function BestandslisteWnd(){

BstDet=window.open('bestandsliste/index.php',"BstLst"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=980,height=400");
BstDet.moveTo(screen.width-980,0);
BstDet.focus(); 

}

function PaysavecardWnd(){

PSCDet=window.open('paysavecard/index.php',"BstLst"," toolbar=0,location=0,status=1,menubar=0,scrollbars=0,resizable=0,width=700,height=500");
PSCDet.focus(); 

}

function PaysavecardPrevWnd(sn){

PSCDPet=window.open('karte-Dateien/slide0001.php?sn='+sn,"PSC"," toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1,width=400,height=300");
PSCDPet.focus(); 

}

function PaysavecardDEMOPrevWnd(sn){

PSCDPet=window.open('karte-Dateien/slide0001.htm?sn='+sn,"PSC"," toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1,width=400,height=300");
PSCDPet.focus(); 

}


function PrintCCinfoWnd(){

PrintCC=window.open('laenderinfo_print.php',"CCINFO"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=300");
PrintCC.focus(); 
}

function Quickorder(ArtId){

Quickorder=window.open('module/presspoint/warenkorb.php?vorgang=ADD&ArtId='+ArtId,"Quickorder"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width=790,height=300");
Quickorder.moveTo(screen.width-790,0);
Quickorder.focus(); 
}


function ShopDEMOWnd(){

dieurl='http://www.evipress.at/index.php?aktion=login&form%5Blogin1%5D=9900000000999&form%5Blief_wahl%5D=shop&form%5Bpasswort%5D=999&x=65&y=51';

ShopDemo=window.open(dieurl,"Shop"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=600");
ShopDemo.focus(); 

}

function ModPresspointWnd(){

dieurl='presspoint/';

ModPresspoint=window.open(dieurl,"Shop"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=790,height=550");
ModPresspoint.focus(); 

}


function ModELoadWnd(dieurl){

ELOADW=window.open(dieurl,"ELOADShop"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=790,height=590");
ELOADW.focus(); 

}



function MModPresspointWnd(dieurl){

if (dieurl == null)
	dieurl='module/presspoint/';

ModPresspoint=window.open(dieurl,"Shop"," toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=790,height=550");
ModPresspoint.moveTo(screen.width-790,0);
ModPresspoint.focus(); 

}

function ModReservierungWnd(dieurl){


ModReservierung=window.open(dieurl,"Reservierung"," toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1,width=790,height=550");
ModReservierung.focus(); 

}

function KassabDEMOWnd(){

dieurl='http://www.evipress.at/index.php?aktion=login&form%5Blogin1%5D=9900000000999&form%5Blief_wahl%5D=kassabuch&form%5Bpasswort%5D=999&x=65&y=51';

KassabDemo=window.open(dieurl,"Kassabuch"," toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1,width=800,height=600");
KassabDemo.focus(); 

}



function show_calendar(str_target, str_datetime) {
	var arr_months = ["Januar", "Februar", "M�rz", "April", "Mai", "Juni",
		          "Juli", "August", "September", "Oktober", "November", "Dezember"];
	var week_days = ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"];
	var n_weekstart = 1; // day week starts from (normally 0 or 1)

	var dt_datetime = (str_datetime == null || str_datetime =="" ?  new Date() : str2dt(str_datetime));
	var dt_prev_month = new Date(dt_datetime);
	dt_prev_month.setMonth(dt_datetime.getMonth()-1);
	var dt_next_month = new Date(dt_datetime);
	dt_next_month.setMonth(dt_datetime.getMonth()+1);
	var dt_firstday = new Date(dt_datetime);
	dt_firstday.setDate(1);
	dt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);
	var dt_lastday = new Date(dt_next_month);
	dt_lastday.setDate(0);
	
	// html generation (feel free to tune it for your particular application)
	// print calendar header
	var str_buffer = new String (
		"<html>\n"+
		"<head>\n"+
		"	<title>Datum ausw�hlen</title>\n"+
		"</head>\n"+
		"<body bgcolor=\"White\">\n"+
		"<table class=\"clsOTable\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n"+
		"<tr><td bgcolor=\"#ababab\">\n"+
		"<table cellspacing=\"1\" cellpadding=\"3\" border=\"0\" width=\"100%\">\n"+
		"<tr>\n	<td bgcolor=\"#ababab\"><a href=\"javascript:window.opener.show_calendar('"+
		str_target+"', '"+ dt2dtstr(dt_prev_month)+ "');\">"+
		"<img src=\"Data/Libs/TraberWEB/StdICO/butback1_kl.gif\" width=\"14\" height=\"13\" border=\"0\""+
		" alt=\"vorhergehender Monat\"></a></td>\n"+
		"	<td bgcolor=\"#ababab\" colspan=\"5\">"+
		"<font color=\"white\" face=\"tahoma, verdana\" size=\"2\">"
		+arr_months[dt_datetime.getMonth()]+" "+dt_datetime.getFullYear()+"</font></td>\n"+
		"	<td bgcolor=\"#ababab\" align=\"right\"><a href=\"javascript:window.opener.show_calendar('"
		+str_target+"', '"+dt2dtstr(dt_next_month)+ "');\">"+
		"<img src=\"Data/Libs/TraberWEB/StdICO/butnext1_kl.gif\" width=\"14\" height=\"13\" border=\"0\""+
		" alt=\"n�chster Monat\"></a></td>\n</tr>\n"
	);

	var dt_current_day = new Date(dt_firstday);
	// print weekdays titles
	str_buffer += "<tr>\n";
	for (var n=0; n<7; n++)
		str_buffer += "	<td bgcolor=\"#cdcdcd\">"+
		"<font color=\"black\" face=\"tahoma, verdana\" size=\"2\">"+
		week_days[(n_weekstart+n)%7]+"</font></td>\n";
	// print calendar table
	str_buffer += "</tr>\n";
	while (dt_current_day.getMonth() == dt_datetime.getMonth() ||
		dt_current_day.getMonth() == dt_firstday.getMonth()) {
		// print row heder
		str_buffer += "<tr>\n";
		for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
				if (dt_current_day.getDate() == dt_datetime.getDate() &&
					dt_current_day.getMonth() == dt_datetime.getMonth())
					// print current date
					str_buffer += "	<td bgcolor=\"#FFB6C1\" align=\"right\">";
				else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
					// weekend days
					str_buffer += "	<td bgcolor=\"#efefef\" align=\"right\">";
				else
					// print working days of current month
					str_buffer += "	<td bgcolor=\"white\" align=\"right\">";

				if (dt_current_day.getMonth() == dt_datetime.getMonth())
					// print days of current month
					str_buffer += "<a href=\"javascript:window.opener."+str_target+
					".value='"+dt2dtstr(dt_current_day)+"';window.close();\">"+
					"<font color=\"black\" face=\"tahoma, verdana\" size=\"2\">";
				else 
					// print days of other months
					str_buffer += "<a href=\"javascript:window.opener."+str_target+
					".value='"+dt2dtstr(dt_current_day)+"';window.close();\">"+
					"<font color=\"gray\" face=\"tahoma, verdana\" size=\"2\">";
				str_buffer += dt_current_day.getDate()+"</font></a></td>\n";
				dt_current_day.setDate(dt_current_day.getDate()+1);
		}
		// print row footer
		str_buffer += "</tr>\n";
	}
	// print calendar footer
	str_buffer +=
		//"<form name=\"cal\">\n<tr><td colspan=\"7\" bgcolor=\"#87CEFA\">"+
		//"<font color=\"White\" face=\"tahoma, verdana\" size=\"2\">"+
		//"Time: <input type=\"text\" name=\"time\" value=\""+dt2tmstr(dt_datetime)+
		//"\" size=\"8\" maxlength=\"8\"></font></td></tr>\n</form>\n" +
		//"</form>\n" +
		"</table>\n" +
		"</tr>\n</td>\n</table>\n" +
		"</body>\n" +
		"</html>\n";

	var vWinCal = window.open("", "Calendar", 
		"width=200,height=200,status=no,resizable=yes,top=200,left=200");
	vWinCal.opener = self;
	var calc_doc = vWinCal.document;
	calc_doc.write (str_buffer);
	calc_doc.close();
}
// datetime parsing and formatting routimes. modify them if you wish other datetime format
function str2dt (str_datetime) {
	re = /^(3[01]|2[0-9]|1[0-9]|0[1-9]|[1-9])\.(0[1-9]|1[012]|[1-9])\.(\d{4})/;
	if (!re.exec(str_datetime))
		return alert("Datumsformat ung�ltig : "+ str_datetime);
	return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1));
}

function dt2dtstr (dt_datetime) {
	return (new String (
			dt_datetime.getDate()+"."+(dt_datetime.getMonth()+1)+"."+dt_datetime.getFullYear()+" "));
}
function dt2tmstr (dt_datetime) {
	return (new String (
			dt_datetime.getHours()+":"+dt_datetime.getMinutes()+":"+dt_datetime.getSeconds()));
}

