//Hyperimage Theme by Lucas Tsolakian www.lucas.gr
//buttons 
jQ(document).ready(function(){
jQ("#footer").delay(1000).slideToggle();
jQ("#slidebutton").click(function(event) {
event.preventDefault();
jQ("#footer").slideToggle(1000);
});
jQ("#slidebutton").click(function(event) {
event.preventDefault();
jQ("#").slideUp();
});
jQ("#footerbutton").click(function(event) {
event.preventDefault();
jQ("#pageheader").slideToggle();
});
jQ("#footerbutton").click(function(event) {
event.preventDefault();
jQ("#").slideUp();
});
});
//hoverimage
jQ(function(){
   jQ(".imgHoverable").hover( function() {
       var hoverImg = HoverImgOf(jQ(this).attr("src"));
       jQ(this).attr("src", hoverImg);
     }, function() {
       var normalImg = NormalImgOf(jQ(this).attr("src"));
       jQ(this).attr("src", normalImg);
     }
   );
});

function HoverImgOf(filename)
{
   var re = new RegExp("(.+)\\.(gif|png|jpg)", "g");
   return filename.replace(re, "$1_hover.$2");
}
function NormalImgOf(filename)
{
   var re = new RegExp("(.+)_hover\\.(gif|png|jpg)", "g");
   return filename.replace(re, "$1.$2");
}
//social
(function(jQ) {
	
	jQ.fn.jsocial = function(options) {

		var options = jQ.extend({
			
			twitter		: null, 
			facebook	: null, 
			flickr		: null, 
			friendfeed	: null, 
			delicious	: null, 
			digg		: null, 
			lastfm		: null, 
			linked		: null, 
			youtube		: null, 
			feed		: null,
			vimeo		: null,
			hyves		: null,
			myspace		: null,
			wordpress	: null,
			tumblr		: null,
			soundcloud	: null,
			orkut   	: null,
			newPage		: null,
			center		: false,
			inline		: false,
			small		: false
			
		},options);
		
	
		return this.each(function() {
			
			if ( options.newPage ) {
				var target = 'target="_blank"';		//if user wants link to open in new page
			};
		
			var jQthis = jQ(this),		//cache 'this' , define variables
				total_links = 0,		//used to auto set the width of ul, for centering
				
				list = '<ul class = "social_links">';	//open the list element
						
if( options.twitter ) {list += '<li><a href="http://twitter.com/' + options.twitter + '" class="twitter" ' + target + '>Twitter</a></li>'; total_links ++;};

if( options.facebook ) {list += '<li><a href="http://' + options.facebook + '" class="facebook" ' + target + ' >Facebook</a></li>'; total_links ++;};

if( options.flickr ) {list += '<li><a href="http://flickr.com/' + options.flickr + '" class="flickr" ' + target + ' >Flickr</a></li>'; total_links ++;};

if( options.friendfeed ) {list += '<li><a href="http://friendfeed.com/' + options.friendfeed + '" class="friendfeed" ' + target + ' >FriendFeed</a></li>'; total_links ++;};

if( options.delicious ) {list += '<li><a href="http://delicious.com/' + options.delicious + '" class="delicious" ' + target + ' >Delicious</a></li>'; total_links ++;};

if( options.digg ) {list += '<li><a href="http://digg.com/users/' + options.digg + '" class="digg" ' + target + ' >Digg</a></li>'; total_links ++;};

if( options.lastfm ) {list += '<li><a href="http://www.last.fm/user/' + options.lastfm + '" class="lastfm" ' + target + ' >Last.FM</a></li>'; total_links ++;};

if( options.linked ) {list += '<li><a href="http://' + options.linked + '" class="linked-in" ' + target + ' >Linked-In</a></li>'; total_links ++;};

if( options.youtube ) {list += '<li><a href="http://' + options.youtube + '" class="youtube" ' + target + ' >YouTube</a></li>'; total_links ++;};

if( options.feed ) {list += '<li><a href="http://feeds.feedburner.com/' + options.feed + '" class="feed" ' + target + ' >Feedburner</a></li>'; total_links ++;};

if( options.vimeo ) {list += '<li><a href="http://vimeo.com/' + options.vimeo + '" class="vimeo" ' + target + ' >Vimeo</a></li>'; total_links ++;};

if( options.hyves ) {list += '<li><a href="http://' + options.hyves + '" class="hyves" ' + target + ' >Hyves</a></li>'; total_links ++;};

if( options.myspace ) {list += '<li><a href="http://' + options.myspace + '" class="myspace" ' + target + ' >Myspace</a></li>'; total_links ++;};

if( options.wordpress ) {list += '<li><a href="http://' + options.wordpress + '" class="wordpress" ' + target + ' >Wordpress</a></li>'; total_links ++;};

if( options.tumblr ) {list += '<li><a href="http://' + options.tumblr + '" class="tumblr" ' + target + ' >Tumblr</a></li>'; total_links ++;};

if( options.soundcloud ) {list += '<li><a href="http://' + options.soundcloud + '" class="soundcloud" ' + target + ' >Soundcloud</a></li>'; total_links ++;};

if( options.orkut ) {list += '<li><a href="http://' + options.orkut + '" class="orkut" ' + target + ' >Orkut</a></li>'; total_links ++;};
			
				list += '</ul>';	//close the ul
			
			jQthis.append(list);	//add the list to the DOM
			
			if ( options.inline ) {
				jQ('ul.social_links li').css('float','left');	//add the float left to each list element
			};	//end inline if
			
			if ( options.small ) {
				jQ(this).removeClass('social').addClass('social_small');
			};	//end small icons if
			
			if ( options.center ) {		//if user wants social list centered
				
				if ( options.small) {	//if they chose small icons
					jQ('ul.social_links').css('width', total_links*26); //calculate the width of the ul for centering
					
				}
				else {		//else they chose large icons
				
				jQ('ul.social_links').css('width', total_links*42); //calculate the width of the ul for centering
				};
				
			};	//end centering if
			
		});  //end each
	
	} //end function
	
})(jQ);
