function sidebarTools(ss){
	var date = new Date();
	date.setTime(date.getTime()+(86400*365*1000));
	if(document.getElementById(ss).style.display=="none"){
		document.getElementById(ss).style.display="";
		setSideCookie(ss, "", date, "", "", "");
	}else{
		document.getElementById(ss).style.display="none";
		setSideCookie(ss, "none", date, "", "", "");
	}
}
function setSideCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}
function F2Gallery(containerId,language)
{
	this.containerId = containerId;
	this.language = language;
	this.container = document.getElementById(this.containerId);
	this.container.style.filter = "progid:DXImageTransform.Microsoft.Fade(duration=0.3, overlap=1.0)";
	this.container.style.textAlign = "center";
	this.container.style.width = "100%";
	this.container.instance = this;
	this.numImages = 0;
	this.imageLoaded = 0;
	this.offset = 0;
	this.playg = 0;
	this.playbutton = "";
	this.src = new Array();
	this.caption = new Array();
	this.width = new Array();
	this.height = new Array();
	this.imageCache = new Array();
}
F2Gallery.prototype.appendImage = function(src, caption, width, height)
{
	this.numImages++;
	var imageCache = new Image();
	imageCache.src = src;
	imageCache.onload = function() { var tmp = this.src; }
	
	this.imageCache[this.imageCache.length] = src;
	this.src[this.src.length] = src;
	this.width[this.width.length] = width;
	this.height[this.height.length] = height;
	this.caption[this.caption.length] = caption;
}
F2Gallery.prototype.getControl = function()
{
	var control = document.createElement("div");
	control.style.marginBottom = "10px";
	control.className = "galleryControl";
	control.style.color = "#777";
	control.style.font = "bold 0.9em Verdana, Sans-serif";
	control.innerHTML = '(' + (this.offset + 1) + '/' + this.numImages + ')  
  
  
  
  ';
	
	return control;
}
F2Gallery.prototype.getImage = function()
{
	var image = document.createElement("img");
	image.instance = this;
	image.src = this.src[this.offset];
	image.width = this.width[this.offset];
	image.height = this.height[this.offset];
	image.onclick = this.showImagePopup2;
	image.style.cursor = "pointer";
	return image;
}
F2Gallery.prototype.getCaption = function()
{
	var captionText = this.caption[this.offset];
	captionText = captionText.replace(new RegExp("<?", "gi"), "<");
	captionText = captionText.replace(new RegExp(">?", "gi"), ">");
	
	var caption = document.createElement("div");
	caption.style.textAlign = "center";
	caption.style.marginTop = "8px";
	caption.style.color = "#627e89";
	caption.className = "galleryCaption";
	caption.appendChild(document.createTextNode(captionText));
	return caption;
}
F2Gallery.prototype.show = function(offset)
{
	if(typeof offset == "undefined")
		this.offset = 0;
	else
	{
		if(offset < 0)
			this.offset = this.numImages -1;
		else if(offset >= this.numImages)
			this.offset = 0;
		else
			this.offset = offset;
	}
	if(this.container.filters)
		this.container.filters[0].Apply();
	
	this.container.innerHTML = "";
	this.container.appendChild(this.getControl());
	this.container.appendChild(this.getImage());
	this.container.appendChild(this.getCaption());
	if(this.container.filters)
		this.container.filters[0].Play();
}
F2Gallery.prototype.prev = function()
{
	this.show(this.offset-1);
}
F2Gallery.prototype.next = function()
{
	this.show(this.offset+1);
}
F2Gallery.prototype.autoplay = function(flag)
{
	this.playg = flag;
	if (flag==1)
	{
		this.play();
	}
}
F2Gallery.prototype.play = function()
{
    this.next();
    this.playtimeout();
}
F2Gallery.prototype.playtimeout = function()
{
	var members = this;
    function fun()
    {
      members.play();
    }
	
    if(this.playg==1){
		setTimeout(fun,3000);
    }
}
F2Gallery.prototype.showImagePopup1 = function()
{
	this.showImagePopup();
}
F2Gallery.prototype.showImagePopup2 = function()
{
	this.instance.showImagePopup();
}
F2Gallery.prototype.showImagePopup = function(offset)
{
	open_img(this.src[this.offset]);
}
function open_img(img_src) {
		blog_url="";
	if (img_src.indexOf("http://")) img_src=blog_url+img_src;
	img_src=img_src.replace('_f2s','');
	img_view = window.open('','img_popup','width=0,height=0,left=0,top=0,scrollbars=auto,resizable=yes');
	img_view.document.write(
	'\n'+ 
	'
';
	
	return control;
}
F2Gallery.prototype.getImage = function()
{
	var image = document.createElement("img");
	image.instance = this;
	image.src = this.src[this.offset];
	image.width = this.width[this.offset];
	image.height = this.height[this.offset];
	image.onclick = this.showImagePopup2;
	image.style.cursor = "pointer";
	return image;
}
F2Gallery.prototype.getCaption = function()
{
	var captionText = this.caption[this.offset];
	captionText = captionText.replace(new RegExp("<?", "gi"), "<");
	captionText = captionText.replace(new RegExp(">?", "gi"), ">");
	
	var caption = document.createElement("div");
	caption.style.textAlign = "center";
	caption.style.marginTop = "8px";
	caption.style.color = "#627e89";
	caption.className = "galleryCaption";
	caption.appendChild(document.createTextNode(captionText));
	return caption;
}
F2Gallery.prototype.show = function(offset)
{
	if(typeof offset == "undefined")
		this.offset = 0;
	else
	{
		if(offset < 0)
			this.offset = this.numImages -1;
		else if(offset >= this.numImages)
			this.offset = 0;
		else
			this.offset = offset;
	}
	if(this.container.filters)
		this.container.filters[0].Apply();
	
	this.container.innerHTML = "";
	this.container.appendChild(this.getControl());
	this.container.appendChild(this.getImage());
	this.container.appendChild(this.getCaption());
	if(this.container.filters)
		this.container.filters[0].Play();
}
F2Gallery.prototype.prev = function()
{
	this.show(this.offset-1);
}
F2Gallery.prototype.next = function()
{
	this.show(this.offset+1);
}
F2Gallery.prototype.autoplay = function(flag)
{
	this.playg = flag;
	if (flag==1)
	{
		this.play();
	}
}
F2Gallery.prototype.play = function()
{
    this.next();
    this.playtimeout();
}
F2Gallery.prototype.playtimeout = function()
{
	var members = this;
    function fun()
    {
      members.play();
    }
	
    if(this.playg==1){
		setTimeout(fun,3000);
    }
}
F2Gallery.prototype.showImagePopup1 = function()
{
	this.showImagePopup();
}
F2Gallery.prototype.showImagePopup2 = function()
{
	this.instance.showImagePopup();
}
F2Gallery.prototype.showImagePopup = function(offset)
{
	open_img(this.src[this.offset]);
}
function open_img(img_src) {
		blog_url="";
	if (img_src.indexOf("http://")) img_src=blog_url+img_src;
	img_src=img_src.replace('_f2s','');
	img_view = window.open('','img_popup','width=0,height=0,left=0,top=0,scrollbars=auto,resizable=yes');
	img_view.document.write(
	'\n'+ 
	'