<!--


function write_swf(filename,id,width,height,extra) {
	document.write('<object type="application/x-shockwave-flash" data="'+filename+(id!=null?'?cid='+id:'')+'" width="'+width+'" height="'+height+'">');
	document.write('<param name="movie" value="'+filename+(id!=null?'?cid='+id:'')+'" />');
	
	document.write('<param name="quality" value="autohigh" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<param name="menu" value="false" />');
	

	for (i in extra) {
			document.write('<param name="'+extra[i][0]+'" value="'+extra[i][1]+'" />');
	}
	document.write('</object>');
}

/* toggle font / line size */
/* set cookie */
//function setCookie(name, value, expires, path, domain, secure) {
function setCookie(name, value, days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

/* get cookie */
function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else {
		begin += 2;
	}
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) {
		end = dc.length;
	}
	return unescape(dc.substring(begin + prefix.length, end));
}

/* delete cookie */
function deleteCookie( name, path, domain ) {
	if ( getCookie(name) ) 
		document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

var text_sizes		= [12, 14, 16];
var line_heights	= [1.4, 1.6, 1.8];

var def_text_size = 0;
var def_line_height = 0;

var current_lh = false;
var current_ts = false;

var first_page = false;
var entry_page = false;

var content_placeholder = 'middleblock';

function change_line_height() {

	if (!current_lh)
	current_lh = getCookie('line_height');

	if (!current_lh) current_lh = def_line_height;
	current_lh ++;
	if (current_lh == line_heights.length) current_lh = 0;

	setCookie('line_height', current_lh, 365);
	if (first_page) {
		document.getElementById('push_news').style.lineHeight = line_heights[current_lh] + "em";
		document.getElementById('push_strokovnjak').style.lineHeight = line_heights[current_lh] + "em";
	} else if (entry_page) {
			document.getElementById('entry_p').style.lineHeight = line_heights[current_lh] + "em";
	} else {
		if (document.getElementById('middleblock')){
		document.getElementById('middleblock').style.lineHeight = line_heights[current_lh] + "em";
		}
	}
}

function change_text_size() {
	if (!current_ts)
		current_ts = getCookie('text_size');
	if (!current_ts) current_ts = def_text_size;
	current_ts ++;
	if (current_ts == text_sizes.length) current_ts = 0;
	setCookie('text_size', current_ts, 365);
	if (first_page) {
		document.getElementById('push_news').style.fontSize = text_sizes[current_ts] + "px";
		document.getElementById('push_strokovnjak').style.fontSize = text_sizes[current_ts] + "px";
	} else if (entry_page) {
		document.getElementById('entry_p').style.fontSize = text_sizes[current_ts] + "px";
	} else {
		if (document.getElementById('middleblock')){
		document.getElementById('middleblock').style.fontSize = text_sizes[current_ts] + "px";
		}
	}
}

/* returns the x,y coordinates of the current screen (for multi monitor setup) */
function get_top_left(width, height){
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
	  		winW = window.innerWidth;
	  		winH = window.innerHeight;
	 		winL = window.screenX;
	 		winT = window.screenY;
	 	} else {
	  		winW = document.body.offsetWidth;
	  		winH = document.body.offsetHeight;
	  		winL = window.screenLeft;
	  		winT = window.screenTop;
	 	}
	}
	
	var scroll = 0;
	var l = winL + winW/2 - width/2;
	var t = winT + winH/2 - height/2;
	
	
  	if(screen.width <= width){
  		width=screen.width;
  	}
  	if(screen.height <= height){
  		height=screen.height;
 	 	var t = 0;
  		var scroll = 1;
  	}
	return Array(t,l);
}

function check_form(obj) {
	if (obj['EMAIL'].value == '') {
		alert('Vnesite e-mail naslov!');
		return false;
	} else if (obj['EMAIL'].value.indexOf('@') == -1) {
		alert('E-mail naslov ni veljaven!');
		return false;
	} else {
		return true;
	}
}

/* generic window opener */
function openwin(uri,title,w,h){
	if(w){wwidth = w;}else{	wwidth = 380;}
	if(h){wheight = h; }else{ wheight = 380;}
	xy = get_top_left(wwidth, wheight);
	wleft = xy[1];
	wtop = xy[0];
	wnd = window.open(uri, title, "width="+wwidth+", height="+wheight+", left="+wleft+", top="+wtop+", toolbar=no, location=no, scrollbars=yes, status=no, menubar=no, resizable=no, directories=no");
}

$(document).ready(function(){
	init_color();
});

function init_color() {
	current_color = getCookie('bc');
	
	if (current_color) {
		$('body').attr({className:current_color});
	}
}


function change_color(class_name) {
	$('body').attr({className:class_name});
	var date = new Date();
		date.setTime(date.getTime()+(24*60*60*30));
		expires = date;
	setCookie('bc', class_name, expires, '/');
	return false;
}

function write_color(){
	document.write($('body').className);
}

function change_registration_mode(checked){
	obj_1 = document.getElementById('COMPANY_TITLE');
	obj_2 = document.getElementById('COMPANY_ID');
	if (checked == true) {
		obj_1.style.display = 'block';
		obj_2.style.display = 'block';
	} else {
		obj_1.style.display = 'none';
		obj_2.style.display = 'none';
	}
}

function check_registration_form() {
	
	
	var validation = false;
	var error = '';
	
	
	var fld_array = new Array('FIRST_NAME','LAST_NAME','COMPANY_NAME','COMPANY_NUMBER','ADDRESS','CITY','COUNTRY','PHONE','EMAIL','PASSWORD','PASSWORD_REPEAT');
	var my_labels = document.getElementsByTagName('label');
	var labels = [];
	
	oProfesional = document.getElementById('PROFESIONAL');
	var is_profesional = (oProfesional.checked == true) ? true: false;
	
	for (i=0; i<fld_array.length; i++){
		var oField;
		var oLabel;
		
		oField = document.getElementById(fld_array[i]);
		
		if (!is_profesional && (fld_array[i] == 'COMPANY_NAME' || fld_array[i] == 'COMPANY_NUMBER')) continue;
		
		if (oField.tagName == 'INPUT') {
			
			for (x=0; x<my_labels.length; x++) {
				var labelText;
				if (my_labels[x].htmlFor == fld_array[i]) {
					labelText = my_labels[x].innerHTML;
				}
			}
			
			if (oField.value == '') {
				error = error + labelText+'\n';
			}
		} 
		
	}
	
	
	if (error) {
		validation = false;
		alert(error);
	} else {
		validation = true;
	}
	
	return (validation) ? true: false; 
	
}



/*
* PROTOTYPES for IE and other older browsers
*/

// in array function
function inArray(needle, haystack)
{
	for (h in haystack) {
		if (haystack[h] == needle) {
			return true;
		}
	}

	return false;
	
}


// indexOf function
if (!Array.prototype.indexOf)
{
  Array.prototype.indexOf = function(elt /*, from*/)
  {
    var len = this.length;

    var from = Number(arguments[1]) || 0;
    from = (from < 0)
         ? Math.ceil(from)
         : Math.floor(from);
    if (from < 0)
      from += len;

    for (; from < len; from++)
    {
      if (from in this &&
          this[from] === elt)
        return from;
    }
    return -1;
  };
} 


function toggle_display(subId, uriId) {
	
	subObj = document.getElementById(subId);
	uriObj = document.getElementById(uriId);
	
	if (subObj.style.display == 'none') {
		subObj.style.display = 'block';
		uriObj.style.backgroundImage = 'url(images/minus.gif)';
	} else {
		subObj.style.display = 'none';
		uriObj.style.backgroundImage = 'url(images/plus.gif)';
	}
}

function alphabetical(param,lang) {
	
	$.ajax({
		cache: false,
		type: 'GET',
		dataType: 'html',
		url: 'data.products.php',
		data: {
			type: 'alphabetical',
			range: param,
			mylang: lang
		},
		success: function(result) {
			$('#alphabetical_result').slideUp('normal', function() {
				$('#alphabetical_result').html(result).slideDown('normal');
			});
		},
		error: function(obj, status, error) {
			alert(error);
		}
	});

	return false;

}

function open_jds(lang, bypass_firstpage, project_id) {

	//zan fix
	if(lang == null) lang = '0';
	
	if (typeof($('#jds_overlay')[0]) == 'undefined') {
		var overlay  = '<div id="jds_overlay"></div>';
		$("body").append(overlay);
		
		// applying style
		$("#jds_overlay").css({
			opacity: 0.7
		});
		
		$("#jds_overlay").css({ height:$(document).height() });
		
		$("#jds_overlay").bind('click', function() {
			$('#jds_frame, #jds_overlay, #jds_close').fadeOut('fast', function() {
				$(window).unbind('scroll', jds_position);
			})
		});
	}
	
	
	
	if (typeof($('#jds_frame')[0]) == 'undefined') {
			var old_html = $("#banner-special").html();
			$("#banner-special").html('<img src="banners/banner_white.gif" />');('<img src="banners/banner_white.gif" />');
		
			var jds_frame = '<iframe id="jds_frame" src="" width="960" height="580" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></iframe>';
			$("body").append(jds_frame);
			
			var frame_left = ($(document).width()/2) - (960/2);
			
			if ($.browser.msie && $.browser.version < 7) {
				var frame_top = $(document).scrollTop() + Math.round(($(window).height() - 580)/2);
			} else {
				var frame_top = Math.round(($(window).height() - 580)/2);
			}
			
			$('#jds_frame').css({
				position: 'absolute',
				left: frame_left,
				top: frame_top
			});
			
			if (typeof($('#jds_close')[0]) == 'undefined') {
				$("body").append('<div id="jds_close"><a href="#"></a></div>');
				
				$('#jds_close').css({
					position: 'absolute',
					left: frame_left + 933,
					top: frame_top - 17
				});
				
				$("#jds_close").bind('click', function() {
					$('#jds_frame, #jds_overlay, #jds_close').fadeOut('fast', function() {
						$(window).unbind('scroll', jds_position);
						$("#banner-special").html(old_html);
					});
				return false;
				});
			}
			
			
	} else {
		var old_html = $("#banner-special").html();
		$("#banner-special").html('<img src="banners/banner_white.gif" />');('<img src="banners/banner_white.gif" />');
	}
	
	
	
	// opening sequence
	$("#jds_overlay").fadeIn('normal', function() {
			var url = 'iframe.jds.php?lang='+lang;
			if (typeof(project_id)!='undefined') {
				url += '&project_id='+project_id;			
			}
			if (typeof(bypass_firstpage)!='undefined') {
				url += '&bypass_firstpage=1';			
			}
			$('#jds_frame')[0].src=url;
			$('#jds_frame').css({ zIndex: 1000 });
			//$('#jds_frame')[0].src='http://jub.active-online.de/si_si/';
			$('#jds_frame, #jds_close').fadeIn('normal');
			
			// IE 7 hack
			// Ce ni IE6, pozicioniraj
			if (typeof document.body.style.maxHeight != "undefined") {
				$('#jds_frame').css({ position: 'fixed' });
				$('#jds_close').css({ position: 'fixed' });
			} else {
				$(window).bind('scroll', jds_position);
			}
	});


}

function open_jje(lang, start) {

	//zan fix
	if(lang == null) lang = '0';
	if (start == null) start = '0';
	
	if (typeof($('#jje_overlay')[0]) == 'undefined') {
		
		var overlay  = '<div id="jje_overlay"></div>';
		$("body").append(overlay);
		
		// applying style
		$("#jje_overlay").css({
			opacity: 0.7
		});
		
		$("#jje_overlay").css({ height:$(document).height() });
		
		$("#jje_overlay").bind('click', function() {
			$('#jje_frame, #jje_overlay, #jje_close').fadeOut('fast', function() {
				$(window).unbind('scroll', jje_position);
			})
		});
	}
	
	
	
	if (typeof($('#jje_frame')[0]) == 'undefined') {
			var old_html = $("#banner-special").html();
			$("#banner-special").html('<img src="banners/banner_white.gif" />');('<img src="banners/banner_white.gif" />');
			var jje_frame = '<iframe id="jje_frame" src="" width="960" height="580" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></iframe>';
			$("body").append(jje_frame);
			
			var frame_left = ($(document).width()/2) - (960/2);
			
			if ($.browser.msie && $.browser.version < 7) {
				var frame_top = $(document).scrollTop() + Math.round(($(window).height() - 580)/2);
			} else {
				var frame_top = Math.round(($(window).height() - 580)/2);
			}
			
			$('#jje_frame').css({
				position: 'absolute',
				left: frame_left,
				top: frame_top
			});
			
			if (typeof($('#jje_close')[0]) == 'undefined') {
				$("body").append('<div id="jje_close"><a href="#"></a></div>');
				
				$('#jje_close').css({
					position: 'absolute',
					left: frame_left + 933,
					top: frame_top - 17
				});
				
				$("#jje_close").bind('click', function() {
					$('#jje_frame, #jje_overlay, #jje_close').fadeOut('fast', function() {
						$(window).unbind('scroll', jje_position);
						$("#banner-special").html(old_html);
					});
				return false;
				});
			}
	} else {
		var old_html = $("#banner-special").html();
		$("#banner-special").html('<img src="banners/banner_white.gif" />');('<img src="banners/banner_white.gif" />');
	}
	
	
	
	// opening sequence
	$("#jje_overlay").fadeIn('normal', function() {
			var url = 'iframe.jje.php?lang='+lang+'&start='+start;
			if (typeof(project_id)!='undefined') {
				url += '&project_id='+project_id;			
			}
			if (typeof(bypass_firstpage)!='undefined') {
				url += '&bypass_firstpage=1';			
			}
			$('#jje_frame')[0].src=url;
			$('#jje_frame').css({ zIndex: 1000 });
			//$('#jds_frame')[0].src='http://jub.active-online.de/si_si/';
			$('#jje_frame, #jje_close').fadeIn('normal');
			
			// IE 7 hack
			// Ce ni IE6, pozicioniraj
			if (typeof document.body.style.maxHeight != "undefined") {
				$('#jje_frame').css({ position: 'fixed' });
				$('#jje_close').css({ position: 'fixed' });
			} else {
				$(window).bind('scroll', jje_position);
			}
	});


}

function jds_position() {
	
	var frame_left = ($(document).width()/2) - (960/2);
	var frame_top = $(document).scrollTop() + Math.round(($(window).height() - 580)/2);
	
	$('#jds_frame').css({
		position: 'absolute',
		left: frame_left,
		top: frame_top,
		zIndex: 100
	});
}
function jje_position() {
	
	var frame_left = ($(document).width()/2) - (960/2);
	var frame_top = $(document).scrollTop() + Math.round(($(window).height() - 580)/2);
	
	$('#jje_frame').css({
		position: 'absolute',
		left: frame_left,
		top: frame_top,
		zIndex: 100
	});
}

 -->
