﻿function toggleBox(boxId, style) {
    document.getElementById(boxId).style.display = style.toString();
}

function toggleLink(linkId, style) {
    document.getElementById(linkId).style.display = style.toString();
}

function quickToggleBlock(boxId) {
    var box = document.getElementById(boxId);
    if (box.style.display == 'none') {
    	box.style.display = 'block';
    } else {
    box.style.display = 'none';
    }
   }


function newWindow(path, w, h)
{
    var height = h;
    var width = w;
    var scroll = 0;
    var wleft = (screen.width - width-20) / 2;
    var wtop = (screen.height - height) / 2;
    window.open(path,'newWin','fullscreen=0,scrollbars='+scroll+',height='+height+',width='+width+',top='+wtop+',left='+wleft+'');
}


function newImageWindow(imgPath)
{
    newImage = new Image();
    newImage.src = (imgPath);
    
    wWidth = newImage.width + 20;
    wHeight = newImage.height + 20;
     window.open(imgPath,'newWin','fullscreen=0,scrollbars=0,height='+wHeight+',width='+wWidth);
}


function LoadGallery(pictureName,imageFile,titleCaption,captionText)
{
  var picture = document.getElementById(pictureName);
  if (picture.filters)
  {
    picture.style.filter="blendTrans(duration=1)";
    picture.filters.blendTrans.Apply();
  }
  picture.src = imageFile;
  if (picture.filters)
  {
    picture.filters.blendTrans.Play();
  }
  document.getElementById(titleCaption).innerHTML=captionText;
 }

 function createCookie(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=/";
 }

 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;
 }
