
/////////////////////// SLIDESHOW BOX RELATED SCRIPTS ///////////////////


/*$(document).ready( function(){
	
	$('#Set02').innerfade({
		speed: 1500,
		timeout: 10000,
		type: 'sequence',
		containerheight: '240px'
	});
	
	$('#Set01').innerfade({
		speed: 1500,
		timeout: 10000,
		type: 'sequence',
		containerheight: '182px'
	});
});*/






/////////////////////// IMAGE RELATED SCRIPTS ///////////////////

/*
 
Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.


*/

/*var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if ((version >= 5.5) && (document.body.filters)) 
{
   for(var i=0; i<document.images.length; i++)
   {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
         i = i-1
      }
   }
}
*/



//////////////// JQUERY SCRIPT TO HIDE AND TOGGLE THE ADMIN LOGIN BUTTON ///////////////////

$(document).ready( function(){
	
	$('#login_link a').hide();
	
	$('#login_link').hover(function() {
		$('#login_link a').fadeIn(1000);
	}, function() {
		$('#login_link a').fadeOut(1000);
	});

});




/////////////////////// CONTACT RELATED SCRIPTS ///////////////////

function emailDiv(divID_as_a_string) {
// for hiding email address from robots	
var part2 = "wingfinger.co.uk";
var at = "@";
var part1 = "pteri";
	var myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) { window.alert('Nothing works in this browser'); return; }
	if( myReference.innerHTML ) { myReference.innerHTML = (part1+at+part2); } else {
		if( myReference.document && myReference.document != window.document ) {
			myReference.document.open();
			myReference.document.write(part1+at+part2);
			myReference.document.close();
		} else {
			window.alert('Your browser does not allow the contents to be re-written.\nI have not implemented an iframe here.\nSee my generic re-writable elements example for how this should be done.'); return; }
    }
}



function linkDiv(divID_as_a_string) {
// for hiding address in mailto from robots	
var part2 = "wingfinger.co.uk";
var at = "@";
var part1 = "pteri";
	var myReference = getRefToDiv(divID_as_a_string);
	if( !myReference ) { window.alert('Nothing works in this browser'); return; }
	if( myReference.innerHTML ) { myReference.innerHTML = ('<a href="mailto:'+part1+at+part2+'">Email</a>'); } else {
		if( myReference.document && myReference.document != window.document ) {
			myReference.document.open();
			myReference.document.write('<a href="mailto:'+part1+at+part2+'">Email</a>');
			myReference.document.close();
		} else {
			window.alert('Your browser does not allow the contents to be re-written.\nI have not implemented an iframe here.\nSee my generic re-writable elements example for how this should be done.'); return; }
    }
}


function generate_address( part1, part2 ) {
// more email hiding
	var atsign = "&#64;";
	var addr = part1 + atsign + part2;
	document.write( "<" + "a" + " " + "href=" + "mail" + "to:" + addr + ">" +addr +"<\/a>");
}


function generate_email(part1, part2, linktext, x) {
// more email hiding
	var atsign = "&#64;";
	var addr = part1 + atsign + part2;
	document.write( "<a " + "href=" + "\"mail" + "to:" + addr + x +"\">" +linktext +"<\/a>");
}







/////////////////////// EXTERNAL LINK SCRIPT - references core.js  ///////////////////

// Adapted from www.phpBB-SEO.com SEO TOOLKIT

var extLink =
	{

		init: function() 
	
		{
	
		   
		   var current_domain = document.domain; 
		   
		   if (!current_domain || !document.getElementsByTagName) return;
		   
		   var aTag = new Array;
		   var aTagLength = 0;
		   var aTagInner = '';
		   
		   aTag = document.getElementsByTagName("a");
		   // Brings in each a tag to an array
		   aTagLength = aTag.length;
		   
		   for (var i = 0; i < aTagLength; i++) 
		   // Going through each item in the array up to the final one it has found
		   
			   {
					aTagInner = aTag[i].innerHTML.toLowerCase();
					// So that indexOf is able to read it and return a value
					
					if ( (aTag[i].href == '') || (aTag[i].href.indexOf('javascript') >=0 ) || (aTagInner.indexOf('<a') >= 0) || (aTag[i].href.indexOf(current_domain) >= 0) || (aTag[i].onclick != null) || (aTag[i].href.indexOf('mailto') >= 0))
						{
							continue;
						}
						// If any of these exceptions are met, the function will not be applied	

					
					// Otherwise, open a new window on mouse click...
					aTag[i].onclick = function () { window.open(this.href); return false; };
				
				}
		
		}
	
	};

//Core.start(extLink);
// Using sitepoint.com structure via their core.js to stop the script running until html page is loaded
