function activateCustomVar(id, formId) {
	/*var form = document.getElementById('voteForm');
	var x = form.vote;
	var l = x.length
	x[l-1].checked = true;*/
}

function activateCustomVarField(id) {
	/*var field = document.getElementById(id);
	field.focus();*/
}

jsHover = function() {
    var hEls = document.getElementById("nav").getElementsByTagName("LI");
    for (var i=0, len=hEls.length; i<len; i++) {
      hEls[i].onmouseover=function() { this.className+=" jshover"; }
      hEls[i].onmouseout=function() { this.className=this.className.replace(" jshover", ""); }
    }
  }
 if (window.attachEvent && navigator.userAgent.indexOf("Opera")==-1) window.attachEvent("onload", jsHover);
 
 function checkTenderForm(message) {
 	form = document.getElementById('tender');
 	//opt = form['position'].options[form['position'].selectedIndex].value;
 	
 	if (!form['propose'].value || !form['coord'].value) {
 		alert(message);
 		return false;
 	}
 }
 
var path = 'http://www.agroresurs.com.ua/';
 
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 4500;
// Duration of crossfade (seconds)
var crossFadeDuration = 5;
// Specify the image files
var Pic = new Array();
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'slideshow/1_a.jpg';
Pic[1] = 'slideshow/1_b.jpg';
Pic[2] = 'slideshow/1_c.jpg';

var Pic2 = new Array();
Pic2[0] = 'slideshow/2_a.jpg';
Pic2[1] = 'slideshow/2_b.jpg';
Pic2[2] = 'slideshow/2_c.jpg';


var Pic3 = new Array();
Pic3[0] = 'slideshow/3_a.jpg';
Pic3[1] = 'slideshow/3_b.jpg';
Pic3[2] = 'slideshow/3_c.jpg';


var Pic4 = new Array();
Pic4[0] = 'slideshow/4_a.jpg';
Pic4[1] = 'slideshow/4_b.jpg';
Pic4[2] = 'slideshow/4_c.jpg';
// do not edit anything below this line
var t;
var j = 0;
var t2;
var j2 = 0;
var t3;
var j3 = 0;
var t4;
var j4 = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0, k = 0; i < p; i++) {
preLoad[i] = new Image();
if (Pic[i] != null && Pic[i] != 'undefined') {
	preLoad[k].src = path + Pic[i];
	k++;
}
}

var p2 = Pic2.length;


var preLoad2 = new Array();
for (i = 0, k = 0; i < p2; i++) {
preLoad2[i] = new Image();
if (Pic2[i] != null && Pic2[i] != 'undefined') {
	preLoad2[k].src = path + Pic2[i];
	k++;
}
}

var p3 = Pic3.length;
var preLoad3 = new Array();
for (i = 0, k = 0; i < p3; i++) {
preLoad3[i] = new Image();
if (Pic3[i] != null && Pic3[i] != 'undefined') {
	preLoad3[k].src = path + Pic3[i];
	k++;
}
}

var p4 = Pic4.length;
var preLoad4 = new Array();
for (i = 0, k = 0; i < p4; i++) {
preLoad4[i] = new Image();
if (Pic4[i] != null && Pic4[i] != 'undefined') {
	preLoad4[k].src = path + Pic4[i];
	k++;
}
}

function runSlideShow() {
	
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow.filters.blendTrans.Apply();
}
document.images.SlideShow.src = preLoad[j].src;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();
}
j = j + 1;
if (j > (p - 1)) j = 0;
t = setTimeout('runSlideShow()', slideShowSpeed);
}

function runSlideShow2() {

if (document.all) {
document.images.SlideShow2.style.filter="blendTrans(duration=2)";
document.images.SlideShow2.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow2.filters.blendTrans.Apply();
}
document.images.SlideShow2.src = preLoad2[j2].src;
if (document.all) {
document.images.SlideShow2.filters.blendTrans.Play();
}
j2 = j2 + 1;
if (j2 > (p2 - 1)) j2 = 0;
t2 = setTimeout('runSlideShow2()', slideShowSpeed);
}


function runSlideShow3() {

if (document.all) {
document.images.SlideShow3.style.filter="blendTrans(duration=2)";
document.images.SlideShow3.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow3.filters.blendTrans.Apply();
}
document.images.SlideShow3.src = preLoad3[j3].src;
if (document.all) {
document.images.SlideShow3.filters.blendTrans.Play();
}
j3 = j3 + 1;
if (j3 > (p3 - 1)) j3 = 0;
t3 = setTimeout('runSlideShow3()', slideShowSpeed);
}


function runSlideShow4() {

if (document.all) {
document.images.SlideShow4.style.filter="blendTrans(duration=2)";
document.images.SlideShow4.style.filter="blendTrans(duration=crossFadeDuration)";
document.images.SlideShow4.filters.blendTrans.Apply();
}
document.images.SlideShow4.src = preLoad4[j4].src;
if (document.all) {
document.images.SlideShow4.filters.blendTrans.Play();
}
j4 = j4 + 1;
if (j4 > (p4 - 1)) j4 = 0;
t4 = setTimeout('runSlideShow4()', slideShowSpeed);
}


function OpenImagePopup(imgPath, title, alt) {
    var win = window.open('','preview',
    'width=50,height=50,left=0,top=0,screenX=0,screenY=0,resizable=1,scrollbar=0,status=0');
    
    var winDoc = win.document;
    if (title == undefined) title = 'My Image, Click to Close';
    if (alt   == undefined) alt   = 'My Image, Click to Close';
    var content = '<html><head><title>' + title + '</title>' +
    			  '<style>body{overflow: hidden;margin:0;}img{border:0;}</style>' +
    			  '</head><body><a href="javascript:self.close()">' +
    			  '<img alt="' + alt + '" id="image" src="' + imgPath + '" /></a></body></html>'
    win.document.write(content);
    
    winDoc.body.onload = function() {
    	var obj = winDoc.getElementById('image');
    	var w = obj.width, h = obj.height;
    	var iHeight= document.body.clientHeight, iWidth = self.innerWidth;
    	
    	var left = (self.opera ? iWidth : screen.availWidth)/2 - w/2;
    	var top =  (self.opera ? iHeight : screen.availHeight)/2 - h/2;
    	win.resizeTo(w+10, h+26);
    	win.moveTo(left, top);
    }
    
    win.onload = winDoc.body.onload; // special for Mozilla
    
    // !!! Important statement: popup onload won't execute without it!
    win.document.close();
    win.focus();
}
