$(document).ready(function() {

	$('.homemask').cycle({
		fx: 'fade', 
		speed: 2000,
		timeout: 6000,
		easeIn: 'easeout',
		easeOut: 'easeout'
	});
	
	$('.prodmask').cycle({
		fx: 'fade', 
		speed: 2000,
		timeout: 6000,
		easeIn: 'easeout',
		easeOut: 'easeout'
	});

    $('.newsmask').cycle({
		fx: 'scrollLeft', 
		speed: 500,
		timeout: 50000
	});

    $('.maskpolo').cycle({
		fx: 'fade', 
		speed: 5000,
		timeout: 8000
	});

	
   $('#main a[href]#info').each(function(){
   
		// you have to use the .each() function to parse each element with its title
		var contentStr = $(this).attr("title");       // take the title and store in a variable
		$(this).attr({ title: "" });                  // empty the element title (now it'suseless)
		$(this).simpletip({                           // apply the simpletip to the element                    			      	
			content: '<div class="tootip-img">' + $("#project-info").html() + '</div>',
			fixed: true,
			 showEffect: 'slide', 
			 hideEffect: 'slide', 
			position: [0,"-63"],
			 persistent: true
		}); 

   });
   
   $('#side #accordion ul li ul li a[href]').each(function(){
   
		// you have to use the .each() function to parse each element with its title
		var contentStr = $(this).attr("title");       // take the title and store in a variable
		$(this).attr({ title: "" });                  // empty the element title (now it'suseless)
		$(this).simpletip({                           // apply the simpletip to the element                    			      	
			content: '<div class="tootip-img"><img src="/assets/images/work/' + contentStr + '.jpg" /></div>',
			fixed: true,
			position: [215,-173]
		}); 

   });
   
	
	$("#open").addClass("active");
	$("#open").show();

	$("#accordion h3").click(function(){
	  $(this).next("div").slideToggle("normal")
	  /* If we don't want to close the other panel, delete the line below */
	  .siblings("div:visible").slideUp("normal");
	  $(this).toggleClass("active");
	  $(this).siblings("h3").removeClass("active");
	});

	
	$("div.thumb").hover(function() { //On hover...

		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'

		//Set a background image(thumbOver) on the <a> tag - Set position to bottom
		//$(this).find("div.thumb-inner").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});

		//Animate the image to 0 opacity (fade it out)
		$(this).find("span").stop().fadeTo('fast', 0 , function() {
			$(this).hide() //Hide the image after fade
		});
	} , function() { //on hover out...
		//Fade the image to full opacity 
		$(this).find("span").stop().fadeTo('fast', 1).show();
	});
	
	
	$('#slideshow').before('<div class="tn">').cycle({ 
		fx:     'fade', 
		speed:  300, 
		timeout: 0, 
		pager:  '.tn', 
		 
		// callback fn that creates a thumbnail to use as pager anchor 
		pagerAnchorBuilder: function(idx, slide) { 
			return '<a href="#" class="png"><img src="' + slide.src.replace("-lrg", "") + '" /></a>'; 
		} 
	});




});

// PHPlist code

var fieldstocheck = new Array();
    fieldnames = new Array();

function checkform() {
  for (i=0;i<fieldstocheck.length;i++) {
    if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
      alert("Please enter your "+fieldnames[i]);
      eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
      return false;
    }
  }

  return true;
}


function addFieldToCheck(value,name) {
  fieldstocheck[fieldstocheck.length] = value;
  fieldnames[fieldnames.length] = name;
}

function compareEmail()
{
  return (document.subscribeform.elements["email"].value == document.subscribeform.elements["emailconfirm"].value);
}


// -- Email Spam Code
var user;
var domain;
var suffix;
function jemail(user, domain, suffix){
document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + user + '@' + domain + '.' + suffix + '</a>');
		}
