﻿/// <reference path="prototype-1.6.0.2.js" />


// JScript File
HIDE_DELAY: 0.5
var ACTION='';
var Bookmarks = Class.create({
	//HIDE_DELAY: 0.5, // how long after mouseout before we 
	EFFECT_DURATION: 0.5,
	DIRECTION: "",
	initialize: function (popupId, togglerId, direction) {
		this.popup = $(popupId);
		this.toggler = $(togglerId);
		this.DIRECTION = direction;
		Event.observe(this.popup, 'mouseout', this.hidePopup.bindAsEventListener(this));
		Event.observe(this.toggler, 'mouseout', this.hidePopup.bindAsEventListener(this));
		Event.observe(this.popup, 'mouseover', this.showPopup.bindAsEventListener(this));
		Event.observe(this.toggler, 'mouseover', this.showPopup.bindAsEventListener(this));
	},

	showPopup: function (event) {
		window.clearTimeout(this.hidingPopup);
		if (this.popup.getStyle("display") == "none") {
			var pos = Element.cumulativeOffset(this.toggler);
			var posTop = pos.top + this.toggler.getHeight() - (Prototype.Browser.IE ? 3 : 1);
			var posBottom = pos.top - this.popup.getHeight();
			var posLeft = pos.left;
			var posRight = pos.left + this.toggler.getWidth() - this.popup.getWidth();
			if(this.DIRECTION == "TOP"){
				Element.setStyle(this.popup, {top: posBottom + "px", left: posLeft + "px"});				
				//Element.setStyle(this.popup, {top: posBottom + "px", left: posRight + "px"});				
			}else{
				Element.setStyle(this.popup, {top: posTop + "px", left: posLeft + "px"});
				//Element.setStyle(this.popup, {top: posTop + "px", left: posRight + "px"});
			}
			this.popup.show();
			if(this.DIRECTION == "TOP"){
				this.toggler.addClassName("fsExpandedTop");
				this.toggler.removeClassName("fsCollapsedTop");			
			}else{
				this.toggler.addClassName("fsExpanded");
				this.toggler.removeClassName("fsCollapsed");
			}		
			this.toggler.makePositioned();
			if (typeof createITT=="function"){
				var tracking_object = createITT();
				if (tracking_object)
				{
					tracking_object.ACTION = '57';
					tracking_object.submit_action();
				}
			}
		}
	},

	hidePopup: function (event) {
		this.hidingPopup = window.setTimeout(this.hidePopupAfterDelay.bindAsEventListener(this), this.HIDE_DELAY * 1000);
	},
	
	hidePopupAfterDelay: function (event) {
		this.popup.hide();
		if(this.DIRECTION == "TOP"){
			this.toggler.addClassName("fsCollapsedTop");
			this.toggler.removeClassName("fsExpandedTop");							
		}else{
			this.toggler.addClassName("fsCollapsed");
			this.toggler.removeClassName("fsExpanded");
		}
		this.toggler.undoPositioned();
	}
});


/* Social Bookmark Script
 * @ version 1.9
 * @ Copyright (C) 2006-2008 by Alexander Hadj Hassine - All rights reserved
 * @ Website http://www.social-bookmark-script.de/
 * @ 
 * @ By using our script you must leave our copyright notices and the links
 * @ in the script untouched. The links doesn't be removed, converted, hidden
 * @ or made invisible. If you set a backlink to http://www.social bookmark script.com/
 * @ (at least 1 time &quot;search engine friendly&quot; from the starting side of your web page)
 * @ you can be adapt the script to you for your purpose changes.
 *--------------------------------------------------------------------------*/

	
function moreOpenWindow(url, site, page_url, page_name, w, h)
{
	if (!w) w = 776;
	if (!h) h = 436;

	this.urlString = url;
    this.urlString = this.urlString.replace("[URL]", page_url);
    this.urlString = this.urlString.replace("[TITLE]", page_name);
    this.urlString = this.urlString.replace("[CONTENT]", "");
    this.urlString = this.urlString.replace("[LOCATION]", "");
    this.urlString = this.urlString.replace("[DESCRIPTION]", "");
    this.urlString = this.urlString.replace("[MEDIA]", "");
    this.urlString = this.urlString.replace("[TOPIC]", "");

	/*var tracking_object = createITT();
	if (tracking_object)
	{
		tracking_object.ACTION = '60';
		tracking_object._s_cf39 = site;
		tracking_object.submit_action();
	}*/
	//alert(this.urlString);
	var win = window.open(this.urlString, "fsMoreBookmarks", "toolbar=0,status=0,scrollbars=1,width=" + w + ",height=" + h);
	win.focus();
	return false;
}		

//
// CopytoClipboard
//
function copyToClipboard(txt)
{
	if(window.clipboardData) 
	{
  	window.clipboardData.clearData();
  	window.clipboardData.setData("Text", txt);
	} 
	else if(navigator.userAgent.indexOf("Opera") != -1) 
	{
		window.location = txt;
	} 
	else if (window.netscape) 
	{
		try 
		{
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
		} 
		catch (e) 
		{
			alert("You need set 'signed.applets.codebase_principal_support=true' at about:config'");
			return false;
		}
		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
		if (!clip)	return;
		var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
		if (!trans)	return;
		trans.addDataFlavor('text/unicode');
		var str = new Object();
		var len = new Object();
		var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
		var copytext = txt;
		str.data = copytext;
		trans.setTransferData("text/unicode",str,copytext.length*2);
		var clipid = Components.interfaces.nsIClipboard;
		if (!clip)	return false;
		clip.setData(trans,null,clipid.kGlobalClipboard);
	}
}

//
//bookmark div 
//
function openNclosediv(divid)
{
	if($(divid).style.display == 'block')
	{
		$(divid).style.display = 'none';
	}
	else if($(divid).style.display = 'none')
	{
		$(divid).style.display = 'block';		
	}
}