// JavaScript Document
//Phase Library Lite v.1.0.3 by Sinko-Programming Solutions :: Šinko - Programska rješenja
function fade1(){
Spry.Effect.AppearFade('im2', {duration:0,from:100,to:50,toggle:false});
Spry.Effect.AppearFade('im3', {duration:0,from:100,to:50,toggle:false});
Spry.Effect.AppearFade('im4', {duration:0,from:100,to:50,toggle:false});
}
function fade2(){
Spry.Effect.AppearFade('im1', {duration:0,from:100,to:50,toggle:false});
Spry.Effect.AppearFade('im3', {duration:0,from:100,to:50,toggle:false});
Spry.Effect.AppearFade('im4', {duration:0,from:100,to:50,toggle:false});
}
function fade3(){
Spry.Effect.AppearFade('im1', {duration:0,from:100,to:50,toggle:false});
Spry.Effect.AppearFade('im2', {duration:0,from:100,to:50,toggle:false});
Spry.Effect.AppearFade('im4', {duration:0,from:100,to:50,toggle:false});
}
function fade4(){
Spry.Effect.AppearFade('im1', {duration:0,from:100,to:50,toggle:false});
Spry.Effect.AppearFade('im2', {duration:0,from:100,to:50,toggle:false});
Spry.Effect.AppearFade('im3', {duration:0,from:100,to:50,toggle:false});
}
function fade1x(){
Spry.Effect.AppearFade('im2', {duration:0,from:50,to:100,toggle:false});
Spry.Effect.AppearFade('im3', {duration:0,from:50,to:100,toggle:false});
Spry.Effect.AppearFade('im4', {duration:0,from:50,to:100,toggle:false});
}
function fade2x(){
Spry.Effect.AppearFade('im1', {duration:0,from:50,to:100,toggle:false});
Spry.Effect.AppearFade('im3', {duration:0,from:50,to:100,toggle:false});
Spry.Effect.AppearFade('im4', {duration:0,from:50,to:100,toggle:false});
}
function fade3x(){
Spry.Effect.AppearFade('im1', {duration:0,from:50,to:100,toggle:false});
Spry.Effect.AppearFade('im2', {duration:0,from:50,to:100,toggle:false});
Spry.Effect.AppearFade('im4', {duration:0,from:50,to:100,toggle:false});
}
function fade4x(){
Spry.Effect.AppearFade('im1', {duration:0,from:50,to:100,toggle:false});
Spry.Effect.AppearFade('im2', {duration:0,from:50,to:100,toggle:false});
Spry.Effect.AppearFade('im3', {duration:0,from:50,to:100,toggle:false});
}

function fade_min1(){
Spry.Effect.AppearFade('min2', {duration:0,from:100,to:50,toggle:false});

}
function fade_min2(){
Spry.Effect.AppearFade('min1', {duration:0,from:100,to:50,toggle:false});
}
function fade_minx1(){
Spry.Effect.AppearFade('min2', {duration:0,from:50,to:100,toggle:false});
}
function fade_minx2(){
Spry.Effect.AppearFade('min1', {duration:0,from:50,to:100,toggle:false});
}


function to_l(da1){
window.ifrm.location=da1;
}
function to_l_in(da2){
window.location=da2;
}
function to_blank(da3){
	top.window.location=da3;
}

function MyPagingFunc(ds, row, rowNumber)
{
	if (rowNumber < pageOffset || rowNumber >= pageStop)
		return null;
	return row;
}

function UpdatePage(offset)
{
	var numRows = dsBugs.getUnfilteredData().length;
	
	if (offset > (numRows - pageSize))
		offset = numRows - pageSize;
	if (offset < 0)
		offset = 0;

	pageOffset = offset;
	pageStop = offset + pageSize;

	// Re-apply our non-destructive filter on dsStates1:
	dsBugs.filter(MyPagingFunc);

	// Tell our 2nd region to update because we've adjusted
	// some of the variables it uses in its spry:if expressions.
	//Spry.Data.updateRegion("list2");

	// Change the XPath for the 3rd data set so that the 3rd
	// region updates. Remember, position() starts at one and not
	// zero, so we have to add one to our pageOffset and pageStop.
	//dsStates3.setXPath("/states/state[position() >=" + (pageOffset+1) + " and position() < " + (pageStop+1) + "]");
}


function MyQueryFunc(autoCompleteWidget, str, contains, dataSet, columnName)
{
	// Auto suggest query functions typically fire off a request to
	// a server. Since all of our data is housed in a single file, all
	// we need to do is make sure that we filter it properly.

	if (!str)
	{
		// The auto suggest widget contains no value in its
		// text field. Install a null filter on the data set
		// so the menu empties out, and then hide it so it can't
		// be seen.
		dataSet.filter(function(ds, row, rowNumber) { return null; });
		autoCompleteWidget.showSuggestions(false);
		return;
	}

	// We have a value to auto suggest against. Build a non-destructive
	// filter that uses this value to decide what rows to keep in the
	// data set. Check the "contains" value that was passed in to this
	// function. If it is false, then we'll only match strings that begin
	// with the auto suggest value, otherwise we will match any string
	// that contains the value.

	var regExpStr = str;
	
	if (!contains)
	 	regExpStr = "^" + regExpStr;

	var regExp = new RegExp(regExpStr, "i");
	
	var filterFunc = function(ds, row, rowNumber)
	{
		var str = row[columnName];
		if (str && str.search(regExp) != -1)
			return row; /* MATCH! */
		return null; /* NO MATCH! */
	};

	dataSet.filter(filterFunc);

	// Now that the data is filtered. Decide if we
	// should show the menu or not.

	autoCompleteWidget.showSuggestions(dataSet.getData().length > 0);
}
function MyQueryFunc1(autoCompleteWidget, str, contains, dataSet, columnName)
{
	// Auto suggest query functions typically fire off a request to
	// a server. Since all of our data is housed in a single file, all
	// we need to do is make sure that we filter it properly.

	if (!str)
	{
		// The auto suggest widget contains no value in its
		// text field. Install a null filter on the data set
		// so the menu empties out, and then hide it so it can't
		// be seen.
		dataSet.filter(function(ds, row, rowNumber) { return null; });
		autoCompleteWidget.showSuggestions(false);
		return;
	}

	// We have a value to auto suggest against. Build a non-destructive
	// filter that uses this value to decide what rows to keep in the
	// data set. Check the "contains" value that was passed in to this
	// function. If it is false, then we'll only match strings that begin
	// with the auto suggest value, otherwise we will match any string
	// that contains the value.

	var regExpStr = str;
	
	if (!contains)
	 	regExpStr = "^" + regExpStr;

	var regExp = new RegExp(regExpStr, "i");
	
	var filterFunc = function(ds, row, rowNumber)
	{
		var str = row[columnName];
		if (str && str.search(regExp) != -1)
			return row; /* MATCH! */
		return null; /* NO MATCH! */
	};

	dataSet.filter(filterFunc);

	// Now that the data is filtered. Decide if we
	// should show the menu or not.

	autoCompleteWidget.showSuggestions(dataSet.getData().length > 0);
	//$("inf_msg").style.display="none";
}

function ch_class(){
document.getElementById('inf_r').className="inf_rc";
document.getElementById('tl1').className="title1v2 p6";
document.getElementById('lt1').className="einl_t p6";
document.getElementById('inf_l').className="einl_t";
document.getElementById('tx').className="text1v2";
document.getElementById('grp1').style.display="inline";
document.getElementById('anl_s').style.display="inline";
document.getElementById('pih').style.display="inline";
}

function ch_vis(){
document.getElementById('info_c').style.display="inline";
}
function ch_vis2(){
document.getElementById('p_wrapper1').style.display="inline";
}


function short_T(el){

var len = 50;	
var p = document.getElementById(el);
	
if (p) {

  var trunc = p.innerHTML;

  if (trunc.length> len) {

    trunc = trunc.substring(0, len);
    trunc = trunc.replace(/\w+$/, '');
    trunc += '...';
    p.innerHTML = trunc;

  }	
}

}

var hide  = true;


function showhide(obj)
{
	var x = new getObj('in_box');
	hide = !hide;
	x.style.visibility = (hide) ? 'hidden' : 'visible';
	setLyr(obj,'in_box');
}

function setLyr(obj,lyr)
{
	/*var x=navigator.userAgent;
	var ie1=x.indexOf("MSIE 5.0");
	var ie2=x.indexOf("MSIE 5.5");
	var ie3=x.indexOf("MSIE 6.0");
	var ie4=x.indexOf("MSIE 7.0");
	var gg=x.indexOf("Gecko");
	var op=x.indexOf("Opera");
	var sa=x.indexOf("Safari");*/
	
	//if (gg>=0){
	var newX = findPosX(obj);
	var newY = findPosY(obj);
	if (lyr == 'in_box') newY += 20;
	var x = new getObj(lyr);
	x.style.top = newY + 'px';
	x.style.left = newX + 'px';
	//}
	/*if (ie1>=0){
	var newX = findPosX(obj) - 5;
	var newY = findPosY(obj) - 4;
	if (lyr == 'testP') newY -= 50;
	var x = new getObj(lyr);
	x.style.top = newY + 'px';
	x.style.left = newX + 'px';
	}
	if (ie2>=0){
	var newX = findPosX(obj) - 5;
	var newY = findPosY(obj) - 4;
	if (lyr == 'testP') newY -= 50;
	var x = new getObj(lyr);
	x.style.top = newY + 'px';
	x.style.left = newX + 'px';
	}
	
	if (ie3>=0){
	var newX = findPosX(obj) - 5;
	var newY = findPosY(obj) - 4;
	if (lyr == 'testP') newY -= 50;
	var x = new getObj(lyr);
	x.style.top = newY + 'px';
	x.style.left = newX + 'px';
	}
	if (ie4>=0){
	var newX = findPosX(obj) - 5;
	var newY = findPosY(obj) - 4;
	if (lyr == 'testP') newY -= 50;
	var x = new getObj(lyr);
	x.style.top = newY + 'px';
	x.style.left = newX + 'px';
	}
	if (op>=0){
	var newX = findPosX(obj) - 2;
	var newY = findPosY(obj) - 3;
	if (lyr == 'testP') newY -= 50;
	var x = new getObj(lyr);
	x.style.top = newY + 'px';
	x.style.left = newX + 'px';
	}
	if (sa>=0){
	var newX = findPosX(obj) - 5;
	var newY = findPosY(obj) - 40;
	if (lyr == 'testP') newY -= 50;
	var x = new getObj(lyr);
	x.style.top = newY + 'px';
	x.style.left = newX + 'px';
	}
*/
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	var printstring = '';
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			printstring += ' element ' + obj.tagName + ' has ' + obj.offsetTop;
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	window.status = printstring;
	return curtop;
}


function getObj(name)
{
 if (document.getElementById)
 {
	   this.obj = document.getElementById(name);
	   this.style = document.getElementById(name).style;
 }
 else if (document.all)
 {
	   this.obj = document.all[name];
	   this.style = document.all[name].style;
 }
 else if (document.layers)
 {
	   if (document.layers[name])
	   {
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	   }
	   else
	   {
	    this.obj = document.layers.testP.layers[name];
	    this.style = document.layers.testP.layers[name];
	   }
 }
}


function gname1(){
$('gname').innerHTML="S&auml;ugetiere u. V&ouml;gel";
}
function gname2(){
$('gname').innerHTML="Spinnen u. Milben";
}
function gname3(){
$('gname').innerHTML="Ameisen";
}
function gname4(){
$('gname').innerHTML="Fliegen, Motten u. Wespen";
}
function gname5(){
$('gname').innerHTML="K&auml;fer";
}
function gname6(){
$('gname').innerHTML="Sonstige";
}
function gn_out(grp){
	
if(grp=="g1"){	
$('gname').innerHTML="S&auml;ugetiere u. V&ouml;gel";
}
if(grp=="g2"){	
$('gname').innerHTML="Spinnen u. Milben";
}
if(grp=="g3"){	
$('gname').innerHTML="Ameisen";
}
if(grp=="g4"){	
$('gname').innerHTML="Fliegen, Motten u. Wespen";
}
if(grp=="g5"){	
$('gname').innerHTML="K&auml;fer";
}
if(grp=="g6"){	
$('gname').innerHTML="Sonstige";
}

}

function marker(id,gr){
window.location="../../index2.php?p="+id+"&g="+gr;
}
