//za odpiranje novih oken
//Animated Window- By Rizwan Chand (rizwanchand@hotmail.com)
//Modified by DD for NS compatibility
//Visit http://www.dynamicdrive.com for this script

function expandingWindow(website) {

var windowprops='width=1,height=1,scrollbars=yes,status=yes,resizable=yes,toolbar=yes'
var heightspeed = 9; // vertical scrolling speed (higher = slower)
var widthspeed = 9;  // horizontal scrolling speed (higher = slower)
var leftdist = 10;    // distance to left edge of window
var topdist = 0;     // distance to top edge of window
/*
if (window.resizeTo&&navigator.userAgent.indexOf("Opera")==-1) {
var winwidth = window.screen.availWidth - leftdist - 10;
var winheight = window.screen.availHeight - topdist - 10;
var sizer = window.open(website,"","left=" + leftdist + ",top=" + topdist +","+ windowprops);
for (sizeheight = 1; sizeheight < winheight; sizeheight += heightspeed)
sizer.resizeTo("1", sizeheight);
for (sizewidth = 1; sizewidth < winwidth; sizewidth += widthspeed)
sizer.resizeTo(sizewidth, sizeheight);
//sizer.location = website;
}
else
*/
window.open(website,'mywindow');
}

// za muvanje sponzorjev
//*****************************************
// Blending Image Slide Show Script- 
// © Dynamic Drive (www.dynamicdrive.com)
// For full source code, visit http://www.dynamicdrive.com/
//*****************************************

//specify interval between slide (in mili seconds)
var slidespeed=3000

//specify images
var slideimages=new Array("polycom.jpg","pustotnik_180.jpg","blegos.jpg","secnik.jpg")

//specify corresponding links
var slidelinks=new Array("http://www.polycom.si",
"/source/sponzorji/pustotnik/pustotnik.htm",
"http://www.gostilnablegos-sp.si",
"http://www.secnik-sp.si")

var newwindow=1 //open links in new window? 1=yes, 0=no

var imageholder=new Array()
var ie=document.all
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}

function gotoshow(){
if (newwindow)
  expandingWindow(slidelinks[whichlink])
else
  window.location=slidelinks[whichlink]
}


/****************************************************
     Author: Eric King
     Url: http://redrival.com/eak/index.shtml
     This script is free to use as long as this info is left in
     Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
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=no';
win=window.open(mypage,myname,settings);}


var origValue = "";
var first = true;
var free = true;
var prefix="<table width='114' height='85' border='0'><tr><td>";  
var suffix="</td></tr></table>";
var temp = null;


function changeToText(thisObj, changeText) {
  if ((first)&&(free)) {
    free = false;
    temp = thisObj;
    origValue = thisObj.innerHTML;
    //alert(origValue);  
    thisObj.setAttribute("className","hint");
    thisObj.innerHTML = changeText;
    first = false;
  }  
}  
 

function changeBack(thisObj) {
  //alert(i);
  if ((!first)&&(!free)) {
    free = false;
    //thisObj.removeAttribute("className");
    //thisObj.innerHTML = origValue;
    temp.removeAttribute("className");
    temp.innerHTML = origValue;
    first = true;
    free = true;
    
  }  
}


adjx = 10;
adjy = 30+12;
ratio = .2;
lamescape=4.75;
function launch_pic(id, picnum){
	var name = navigator.appName;
	if (name == "Opera") {
		mw=window.open('/enlargepic.aspx?slika='+id+'&allpic='+picnum,'slika','scrollbars=no,toolbar=0,status=0,location=0');
	}
	else {
		x=150;
		y=50;
		xresnow = x;
		yresnow = y;
		if (navigator.appVersion.indexOf("Mac")!=-1 && document.all) {
			xresnow-=0;
			yresnow-=0;
		}
		xl = (screen.availWidth/2)-(xresnow/2);
		tt = (screen.availHeight/2)-(yresnow/2);
		if (document.all) mw=window.open('/enlargepic.aspx?slika='+id+'&allpic='+picnum,'slika','scrollbars=no,width='+xresnow+',height='+yresnow+',left='+xl+',top='+tt);
		else {
			if (parseFloat(navigator.appVersion)<4.75)
				mw=window.open('/enlargepic.aspx?slika='+id+'&allpic='+picnum,'slika','left='+xl+',top='+tt+',width='+x+',height='+y+',toolbar=0,status=0,location=0');
			else {
				mw=window.open('enlargepic.aspx?slika='+id,'slika','scrollbars=no,toolbar=0,status=0,location=0');
				setTimeout("mwFix("+xl+","+tt+",x,y)",10);
			}
		}
	}
}

function mwFix(ll,tt,ww,hh) {
  ow=window.outerWidth-window.innerWidth;
  oh=window.outerHeight-window.innerHeight;
  mw.resizeTo(ww-ow,hh);
  mw.moveTo(ll,tt);
}
function toggleVisibility(id, NNtype, IEtype, WC3type) {
    if (document.getElementById) {
        eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
    } else {
        if (document.layers) {
            document.layers[id].visibility = NNtype;
        } else {
            if (document.all) {
                eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
            }
        }
    }
}
function resizer(xres,yres) {
  if (navigator.appVersion.indexOf("Mac")!=-1 || (document.layers && parseFloat(navigator.appVersion)<lamescape)) {
		lleft=(screen.availWidth/2)-(xres/2);
    ttop=(screen.availHeight/2)-(yres/2);
		if (document.all) {
			xres-=0;
			yres-=0;
		}
		ww=window.open(location,'slikac','left='+lleft+',top='+ttop+',width='+(xres)+',height='+(yres+17)+',toolbar=0,status=0,location=0,scrollbars=no');
		window.location="bla.html";
		return;
  } else if (document.layers) yres+=7;
	xres = xres;
	yres = yres;
	xnew = xresnow+((xres-xresnow)*ratio);
	ynew = yresnow+((yres-yresnow)*ratio);
	setTimeout("resizeIt('"+xres+"','"+yres+"','"+xnew+"','"+ynew+"')",100);
}
	
function resizeIt(xres,yres,xnew,ynew){
	x = xresnow;
	y = yresnow;
  ow=0;
  oh=0;
  if (document.layers) {ow=-window.outerWidth+window.innerWidth+2;oh=-window.outerHeight+window.innerHeight;}
	resizeTo(x+ow,y+oh);
	moveTo(((screen.availWidth/2)-(xresnow/2)),((screen.availHeight/2)-(yresnow/2)));
	xresnow = xresnow+((xres-xresnow)*ratio)
	yresnow = yresnow+((yres-yresnow)*ratio)
	if (((xresnow-xres) <= .5)&&((xresnow-xres) >= -.5)) {  xnew=Math.floor(xres); ynew=Math.floor(yres); resizeTo(xnew+ow,ynew+oh);}		
	if (xnew != xres) setTimeout("resizeIt('"+xres+"','"+yres+"','"+xnew+"','"+ynew+"')",10);

}
	
function home(){
	xres = 600+adjx;
	yres = 400+adjy;
  if (navigator.appVersion.indexOf("Mac")!=-1 || (document.layers && parseFloat(navigator.appVersion)<lamescape)) {
    window.close();
    return;
  } else if (document.layers) {
		yres+=7;
	}
	if (document.all) FlashLayer.style.visibility = 'hidden';
  else document.layers['FlashLayer'].visibility = 'hidden';
	if (document.all) TagLine.style.visibility = 'hidden';
  else document.layers['TagLine'].visibility = 'hidden';    
	xnew = xresnow+((xres-xresnow)*ratio);
	ynew = yresnow+((yres-yresnow)*ratio);
	setTimeout("resizeIt('neki.html','"+xres+"','"+yres+"','"+xnew+"','"+ynew+"')",100);
}

var BaseHref=document.location.href.substring(0,document.location.href.lastIndexOf("/") +1);
function povecaj(pic) {
  launch_pic(BaseHref + pic, allpic);
}

// save current scroll position to cookie
function setPosition()
{
  SetCookie('scrollXPos', document.body.scrollLeft);
  SetCookie('scrollYPos', document.body.scrollTop);
}

// get saved scroll position from cookie
function getPosition()
{
  var scrollXPos = GetCookie('scrollXPos');
  var scrollYPos = GetCookie('scrollYPos');
  if (!(scrollXPos == null) && !(scrollYPos == null))
    window.scrollTo(parseInt(scrollXPos),parseInt(scrollYPos));
    
}

// test function
function printCookie(sName)
{
  document.writeln(GetCookie(sName));
  //document.writeln(document.cookie);
}

// Create a cookie with the specified name and value.
// The cookie expires at the end of the 20th century.
function SetCookie(sName, sValue)
{
  document.cookie = sName + "=" + escape(sValue) + ";" ;
}

// Retrieve the value of the cookie with the specified name.
function GetCookie(sName)
{
  // cookies are separated by semicolons
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    // a name/value pair (a crumb) is separated by an equal sign
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0]) 
      return unescape(aCrumb[1]);
  }

  // a cookie with the requested name does not exist
  return null;
}

/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
sample:
<a href="http://wsabstract.com" onclick="NewWindow(this.href,'name','400','400','yes');return false">Website Abstraction</a>
directories
location
menubar
resizable
status
toolbar

For example, to give the window a location bar, variable "settings" should look like this:

settings =
'height='+h+',width='+w+',top='+TopPosition+',
left='+LeftPosition+',scrollbars='+scroll+',resizable, location'



*/

var win = null;
function NewWindow_mail(id){
  mypage = 'replyOnEmail.aspx?id='+id;
  //alert(mypage);
  myname = "_new";
  w = '750';
  h = '450';
  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  //alert(LeftPosition);
  TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  //alert(TopPosition);
  settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition;
  //alert(settings);
  win = window.open(mypage,myname,settings);
}

function openImenik(type){
  mypage = 'imenik.aspx?type='+type;
  myname = "_new";
  w = '750';
  h = '450';
  LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  //alert(LeftPosition);
  TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  //alert(TopPosition);
  settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition + ',scrollbars=yes';
  //alert(settings);
  win = window.open(mypage,myname,settings);
}

function addEmail(email){
  var emails = opener.Form1.EmailsTB.value;
  if ((emails.length == 0)||((emails.length > 2)&&(emails.substring(emails.length - 2,emails.length) == "\r\n")))
    emails += email;
  else
    emails += "\r\n" + email;  
  opener.Form1.EmailsTB.value = emails;
  alert("DODAN!") 
}

function addMobitel(mobitel){
  var mobitels = opener.Form1.GsmTB.value;
  if ((mobitels.length == 0)||((mobitels.length > 2)&&(mobitels.substring(mobitels.length - 2,mobitels.length) == "\r\n")))
    mobitels += mobitel;
  else
    mobitels += "\r\n" + mobitel;
  opener.Form1.GsmTB.value = mobitels;
  alert("DODAN!")
}


  