Cufon.replace('h1, h2, #main-nav a');

function open_pop(url) {
  void(window.open('http://www.oriola-kd.fi/'+url, 'test', 'width=515,height=240,toolbar=no,scrolling=no,statusbar=no,directories=no'));
}

function navi_hover(element, pic, mode) {
	var img_path = '/files/oriola-kd/images/';
	
	var img_hover_path = img_path+'nav1_'+pic+'.gif';
	var img_out_path   = img_path+'nav0_'+pic+'.gif';
	
	if(mode == 1) {
		element.src = img_hover_path;
	}
	else {
		element.src = img_out_path;
	}
}

function navi_hover_se(element, pic, mode) {
	var img_path = '/files/oriola-kd/se_images/';
	
	var img_hover_path = img_path+'nav1_'+pic+'.gif';
	var img_out_path   = img_path+'nav0_'+pic+'.gif';
	
	if(mode == 1) {
		element.src = img_hover_path;
	}
	else {
		element.src = img_out_path;
	}
}


function navi_hover_en(element, pic, mode) {
	var img_path = '/files/oriola-kd/images/';
	
	var img_hover_path = img_path+'en_nav1_'+pic+'.gif';
	var img_out_path   = img_path+'en_nav0_'+pic+'.gif';
	
	if(mode == 1) {
		element.src = img_hover_path;
	}
	else {
		element.src = img_out_path;
	}
}

function text_size(size) {
	if(size == 1) {
		setStyleSheet('text_normal', true);
		setStyleSheet('text_big', false);
		
		createCookie('oriolakd_text_size', '1', 3600);
	}
	if(size == 2) {
		setStyleSheet('text_normal', false);
		setStyleSheet('text_big', true);
		
		createCookie('oriolakd_text_size', '2', 3600);
	}
}

function setStyleSheet(title, mode) {
	var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
			if(a.getAttribute("title") == title) a.disabled = (mode)?false:true;
		}
	}
}

function createCookie(name, value, time) {
  if(time) {
    var date = new Date();
    date.setTime(date.getTime()+time);
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function check_font_size() {
	var font_size_value = readCookie('oriolakd_text_size');
	
	if(font_size_value) {
		text_size(font_size_value);
	}
}


