/*
 AHOJ 
*/
/* 
	class:		Page
	file:		wapi.js
	project: 	wapi
	date:		22.09.2001
	version:	0.1
	note:		
	
	-----------------------------------------------------

	copyright (c) 2001 robert walaski [robert@walaski.cz]

USING:

1. include this library as your first Javasript in your HTML page:
	<SCRIPT SRC="wapi.js" TYPE="text/javascript"></SCRIPT>


INTERFACE:

Variables:

Functions:

	A_Href_StatusBar(txt)
		- shows text in status bar
	A_Href_Over(txt,iname,ipath)
	A_Href_Out(iname,ipath)
		- changes images while mouse is going over or out from specified id object
	Question(text)
		- shows question and return true or false
	ClearValue(id,text)
		- clears value in object specified by id (almoust used in forms)
	RefreshValue( id, text)
		- refresh in form object default value, if none was typed
	BackgroundColor(id,color)
		- changes background color of id object
	

-----------------

HISTORY:

0.1 - The first. 

-----------------

LICENSE:
Commercial for any use (ask for a license)
No support at all.

-----------------
*/


/*
============================================================
Script:    Basic No-Right-Click Script
Functions: Blocks right-click on mouse and shows alert box
Browsers:  NS & IE 4.0 & later; degrades gracefully
Author:    etLux
============================================================

Put the following script in the head of your page:
*/

/*

 (C) 2000 www.CodeLifter.com
	http:www.codelifter.com
 Free for all users, but leave in this  header

 Set the message for the alert box
am = "This function is disabled!";

 do not edit below this line
 ===========================
bV  = parseInt(navigator.appVersion)
bNS = navigator.appName=="Netscape"
bIE = navigator.appName=="Microsoft Internet Explorer"

function nrc(e) {
   if (bNS && e.which > 1){
      alert(am)
      return false
   } else if (bIE && (event.button >1)) {
     alert(am)
     return false;
   }
}

document.onmousedown = nrc;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (bNS && bV<5) window.onmousedown = nrc;
*/

// starting code
buttons = new Array()
buttons_over = new Array()

if( !button) 
	alert('button.defined')
else
for (i=0;i<button.length;i++) 
  {
  buttons[i] = new Image()
  buttons_over[i] = new Image()
  buttons[i].src = "images/buttons/" + button[i] + ".gif"
  buttons_over[i].src = "images/buttons/" + button[i] + "_over.gif"
}


function showhint(text, image)
{
//if (showhint.arguments.length < 2) return

var i
var f=false

//if (is_nav && image.name=="novahra") return
for (i=0;i<button.length;i++) {
  if (image.name == button[i]) {
     f=true
     break
     }
  }
if (f) {
	image.src = (text != "") ? buttons_over[i].src : buttons[i].src;
	self.status = text
	}
}



/***[ A_Href_StatusBar ]****************************************************/

function A_Href_StatusBar(txt)
{ 
  window.status = txt;
}

  
/***[ A_Href_Over ]*********************************************************/

function A_Href_Over(txt,iname,ipath)
{
  if( iname!='')
    document.images[iname].src = ipath+iname+'_over.gif';   
  window.status = txt;
}

/***[ A_Href_Out ]**********************************************************/

function A_Href_Out(iname,ipath) { 
  if( iname!='')
    document.images[iname].src = ipath+iname+'.gif';   
  window.status = ''; 
}  

/***[ Image_Over ]*********************************************************/
function Image_Over(iname,file)
{
//	alert(iname);
//	alert(file);
//nomFormulaire.elements[index].nomPropriété
//document.form.reset()valuename
alert(document.forms[0].submit.value);
//  if( iname!='')
//      document.form.button.iname.src = file;
	  
//    document.images[iname].src = file;
}

/***[ Image_Out ]*********************************************************/
function Image_Out(iname)
{
  if( iname!='')
    document.images[iname].src = iname;
}

/***[ Question ]************************************************************/

function Question(text) { 
    if(!confirm(text))
    {
      return false;
    }
	return true;
}  

function Alert(text) { 
	alert(text);
//	return true;
}  

function AlertQuestion(text_alert,text_question) { 
	alert(text_alert);
//	return true;
    if(!confirm(text_question))
    {
      return false;
    }
	return true;
}  

/***[ ClearValue ]**********************************************************/

function ClearValue(id,text) {
	if (id.value==text) 
	{
		id.value='';
	}
}


/***[ BackgroundColor ]*****************************************************/

function BackgroundColor(id,color) {
	id.style.backgroundColor = color;
}


// Return a boolean value telling whether 
// the first argument is an Array object. 
function isArray() {

if (typeof arguments[0] == 'object') {
  var criterion =
    arguments[0].constructor.toString().match(/array/i);
   return (criterion != null);
  }
return false;
} 


function showInfoMessage(text) {
if( typeof(text)=="undefined")
;
else
	if( isArray(text)) {
		for(i=0;i<text.length;i++)
			alert(text[i]);
	}
	else
		alert(text);
}

/***[ RefreshValue ]********************************************************/

function RefreshValue( id, text) {
	if (id.value=='') 
	{ 
		id.value=text;
	}
}

/***[ PrintPage ]***********************************************************/
function PrintPage() {
   if(document.all || document.layers)
      { window.print(); }
   else { 
	    text = 'Pokud chcete vytisknout stránku, tak  použijte volbu svého prohlížeče:\n\nTISK (PRINT). tlačítkem \nZPĚT (BACK) se dostanete znovu do celého článku.'
   		window.alert( text); 
	}
}


/***[ ShowImage ]***********************************************************/
function ShowImage(URL, x, y) {
    var left_, top_;

    with (window.screen) {
        left_ = width_ - width_/2;
        top_ = height_ - height_/2;
    }

	myurl = "URL"+Math.floor(Math.random()*10000);
	aWindow = 
window.open(URL, myurl, "top=" + top_ +  ",left=" + left_ + ",width="+x+",height="+y+",toolbar=0,directories=0,menubar=0,status=no,resizable=0,location=no,scrollbars=0,copyhistory=0");
	aWindow.focus();
	}

/***[ OpenWindow ]**********************************************************/
function OpenWindow(URL, x, y, parameters) {
    var left_, top_;

    with (window.screen) {
        left_ = width/2 - x/2;
        top_ = height/2 - y/2;
    }

	myurl = "URL"+Math.floor(Math.random()*10000);
	aWindow = 
window.open(URL, myurl, "top=" + top_ +  ",left=" + left_ + ",width="+x+",height="+y+",toolbar=0,directories=0,menubar=0,status=no,resizable=0,location=no,scrollbars=0,copyhistory=0,"+parameters);
	aWindow.focus();
}

	
/***[ OpenWindow2 ]*********************************************************/
function OpenWindow2(URL, params, wid, hei) {
    var left_, top_, width_, height_;

	if( wid>0) 
		width_ = wid;
	else
		width_ = window.screen.width/2;
		
	if( hei>0) 
		height_ = hei;
	else
		height_ = window.screen.height/2;


    with (window.screen) {
		
        left_ = window.screen.width/2 - width_/2;
        top_ = window.screen.height/2 - height_/2;
    }
	
	if( params.length>0)
		sep = ",";
	else
		sep = "";
//		alert( params.length);

	myurl = "URL"+Math.floor(Math.random()*10000);
	aWindow = 
window.open(URL, myurl, "top=" + top_ +  ",left=" + left_ + ",width=" + width_ + ",height=" + height_ + sep + params);
	aWindow.focus();
	}
	
/***[ class Cookie ]********************************************************/
var wapi_Cookie = {
    Write:function(name,value,days) {
        var D = new Date();
        D.setTime(D.getTime()+86400000*days)
        document.cookie = escape(name)+"="+escape(value)+
            ((days == null)?"":(";expires="+D.toGMTString())) + ";path=/"
        return (this.Read(name) == value);
    },
    Read:function(name) {
        var EN=escape(name);
        var F=' '+document.cookie+';', S=F.indexOf(' '+EN);
        return S==-1 ? null : unescape(     F.substring(EN=S+EN.length+2,F.indexOf(';',EN))    );
    }
} 

/*
	\param	id_object	id objekt, ktery se ma roztahnout
	\param	used_height	už použíta velikost objektu, odecte se od citelne velikosti okna
*/
function wholePageHeight(id_object,used_height,xhtml) {
	if( xhtml==true)
		var sh = document.documentElement.clientHeight
	else
		var sh = document.body.clientHeight
	this.document.getElementById(id_object).style.height = sh - used_height-2
}

function preloadImages() { //v2.0
  if (document.images) {
    var imgFiles = preloadImages.arguments;
    if (document.preloadArray==null) document.preloadArray = new Array();
    var i = document.preloadArray.length;
    with (document) for (var j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){
      preloadArray[i] = new Image;
      preloadArray[i++].src = imgFiles[j];
  } }
}


function checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL) { //v3.0
  var newURL='', verStr=navigator.appVersion, app=navigator.appName, version = parseFloat(verStr);
  if (app.indexOf('Netscape') != -1) {
    if (version >= NSvers) {if (NSpass>0) newURL=(NSpass==1)?URL:altURL;}
    else {if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;}
  } else if (app.indexOf('Microsoft') != -1) {
    if (version >= IEvers || verStr.indexOf(IEvers) != -1)
     {if (IEpass>0) newURL=(IEpass==1)?URL:altURL;}
    else {if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;}
  } else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;
  if (newURL) { window.location=unescape(newURL); document.MM_returnValue=false; }
}


//
// hideElement

function hideElement(id_object) {

	this.document.getElementById(id_object).style.display='none'; 
}