﻿/***************************/
//@Author: Adrian "yEnS" Mato Gondelle & Ivan Guardado Castro
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

$(document).ready(function(){
	//global vars
	var searchBoxes = $(".text");
	var searchBox1 = $("#search1");
	var searchBox2 = $("#search2");
	var searchBox2Default = "";
	
	//Effects for both searchbox
	searchBoxes.focus(function(e){
		$(this).addClass("active");
	});
	searchBoxes.blur(function(e){
		$(this).removeClass("active");
	});
	
	//Searchbox1, set focus when document is ready
	searchBox1.focus();
	
	//Searchbox2 show/hide default text if needed
	searchBox2.focus(function(){
		if($(this).attr("value") == searchBox2Default) $(this).attr("value", "");
	});
	searchBox2.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox2Default);
	});
});

function countClick(id,islink){
			  httpObject = getHTTPObject();
			  if (httpObject != null) {
			    httpObject.open("GET", "clicks.php?idlinks=" + id + "&islink=" + islink, true);
			    httpObject.send(null);
			  }
			}

function getHTTPObject(){
			  if (window.ActiveXObject)
			    return new ActiveXObject("Microsoft.XMLHTTP");
			  else if (window.XMLHttpRequest)
			    return new XMLHttpRequest();
			  else {
			    alert("Your browser does not support AJAX.");
			    return null;
			  }
			}

var httpObject = null;

function addBookmark(url, title)
{
  if (!url) url = location.href;
  if (!title) title = document.title;
 
  //Gecko
  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel ("title", "url", "");
  //IE4+
  else if (typeof window.external == "object") window.external.AddFavorite("url", "title");
  //Opera7+
  else if (window.opera && document.createElement)
  {
    var a = document.createElement('A');
    if (!a) return false; //IF Opera 6
    a.setAttribute('rel','sidebar');
    a.setAttribute('href',url);
    a.setAttribute('title',title);
    a.click();
  }
  else return false;
 
  return true;
}
