// JavaScript Document
//if(document.contact_us_form.browsebutton != null)
//{
//	document.contact_us_form.browsebutton.disabled=true;
//}
function changeBackground()
{
	if (document.getElementById('current') != null)
	{
		document.getElementById('current').style.background="#FFFFFF"
		document.getElementById('current').style.color="#0038A5"
	}
}


function whiteBackground()
{
	if (document.getElementById('current') != null)
	{
		document.getElementById('current').style.color="#FFFFFF"
		document.getElementById('current').style.background="#59B9F5"
	}
}

function rollsubmit()
   {
   document.sub_but.src = img_src;
   }
   
function textblank(pointer)
{
	if (pointer.value == pointer.defaultValue)
	{
	pointer.style.color="#0000FF";
	pointer.value='';
	}
}

   
function textog(pointer)
{
	if (pointer.value=='')
	{
	pointer.style.color="#0000FF";
	pointer.value=pointer.defaultValue;
	}
}

function cvcheckboxchange(pointer)
{
	
	if ((pointer.name="recruitmentchkbox"))
	{
		if (document.contact_us_form.cvbrowsebutton.disabled==true)
		{
		document.contact_us_form.cvbrowsebutton.disabled=false;
		alert("Enabled");
		return true;
		}
		if (document.contact_us_form.cvbrowsebutton.disabled==false)
		{
			alert("disabled");
		document.contact_us_form.cvbrowsebutton.disabled=true;
				return true;
		}
	}
}

function cvcheckboxchange(pointer)
{
	
	if ((pointer.name="cvchkbox"))
	{
		if (document.contact_us_form.cvbrowsebutton.disabled==true)
		{
		document.contact_us_form.cvbrowsebutton.disabled=false;
		document.getElementById('cvinfo').style.visibility="visible";
		return true;
		}
		if (document.contact_us_form.cvbrowsebutton.disabled==false)
		{
		document.getElementById('cvinfo').style.visibility="hidden";
		document.contact_us_form.cvbrowsebutton.disabled=true;
				return true;
		}
	}
}

function partnercheckboxchange(pointer)
{
//	alert("Changing visibility function started");
	if ((pointer.name="partnerchkbox"))
	{
//		alert("Checkbox verified");
		if (document.getElementById('partnertext').disabled==true)
		{
//			alert("Changing visibility");
		document.getElementById('partnertext').disabled=false;
		return true;
		}
		if (document.getElementById('partnertext').disabled==false)
		{
		document.getElementById('partnertext').disabled=true;
		return true;
		}
	}
}

function set_news_height()
{
var elements = document.getElementsByTagName("span");
	for(i=0; i<elements.length; i++)
	{
	
		if (elements[i].title=="news_item")
		{
		 elements[i].style.height="40px";
		}
	}
}
function show_news_item(pointer){
ElementStyle = document.getElementById(pointer).style
	if (ElementStyle.height=="40px")
	{
		ElementStyle.height="100%";
	}
	else
	{
		ElementStyle.height="40px";
	}
}

/**
From here starts the fader effect on images
**/
var gradualFader={}

gradualFader.baseopacity=0.4 //set base opacity when mouse isn't over element (decimal below 1)
gradualFader.increment=0.2 //amount of opacity to increase after each iteration (suggestion: 0.1 or 0.2)

document.write('<style type="text/css">\n') //write out CSS to enable opacity on "gradualfader" class
document.write('.gradualfader{filter:progid:DXImageTransform.Microsoft.alpha(opacity='+gradualFader.baseopacity*100+'); -moz-opacity:'+gradualFader.baseopacity+'; opacity:'+gradualFader.baseopacity+';}\n')
document.write('</style>')

gradualFader.setopacity=function(obj, value){ //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
	var targetobject=obj
	if (targetobject && targetobject.filters && targetobject.filters[0]){ //IE syntax
		if (typeof targetobject.filters[0].opacity=="number") //IE6
			targetobject.filters[0].opacity=value*100
		else //IE 5.5
			targetobject.style.filter="alpha(opacity="+value*100+")"
		}
	else if (targetobject && typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
		targetobject.style.MozOpacity=value
	else if (targetobject && typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
		targetobject.style.opacity=value
	targetobject.currentopacity=value
}

gradualFader.fadeupdown=function(obj, direction){
	var targetobject=obj
	var fadeamount=(direction=="fadeup")? this.increment : -this.increment
	if (targetobject && (direction=="fadeup" && targetobject.currentopacity<1 || direction=="fadedown" && targetobject.currentopacity>this.baseopacity)){
		this.setopacity(obj, targetobject.currentopacity+fadeamount)
		window["opacityfader"+obj._fadeorder]=setTimeout(function(){gradualFader.fadeupdown(obj, direction)}, 50)
	}
}

gradualFader.clearTimer=function(obj){
if (typeof window["opacityfader"+obj._fadeorder]!="undefined")
	clearTimeout(window["opacityfader"+obj._fadeorder])
}

gradualFader.isContained=function(m, e){
	var e=window.event || e
	var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
	while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
	if (c==m)
		return true
	else
		return false
}

gradualFader.fadeinterface=function(obj, e, direction){
	if (!this.isContained(obj, e)){
		gradualFader.clearTimer(obj)
		gradualFader.fadeupdown(obj, direction)
	}
}

gradualFader.collectElementbyClass=function(classname){ //Returns an array containing DIVs with specified classname
	var classnameRE=new RegExp("(^|\\s+)"+classname+"($|\\s+)", "i") //regular expression to screen for classname within element
	var pieces=[]
	var alltags=document.all? document.all : document.getElementsByTagName("*")
	for (var i=0; i<alltags.length; i++){
		if (typeof alltags[i].className=="string" && alltags[i].className.search(classnameRE)!=-1)
			pieces[pieces.length]=alltags[i]
	}
	return pieces
}

gradualFader.init=function(){
	var targetobjects=this.collectElementbyClass("gradualfader")

	for (var i=0; i<targetobjects.length; i++){
		targetobjects[i]._fadeorder=i
		this.setopacity(targetobjects[i], this.baseopacity)
		targetobjects[i].onmouseover=function(e){gradualFader.fadeinterface(this, e, "fadeup")}
		targetobjects[i].onmouseout=function(e){gradualFader.fadeinterface(this, e, "fadedown")}
	}
}


/**
End of Fader Script
**/


function set_enlarge_image()
{
//	image_to_enlarge=document.getElementById('image_web').src;
//	alert(image_to_enlarge);
	if (document.getElementById('image_web') != null){
	subString = ".";
	fullString = document.getElementById('image_web').src;
	firsthalf=fullString.substring(0, fullString.lastIndexOf(subString));
	extension=fullString.substr(fullString.lastIndexOf('.'));
	msg = firsthalf + "_large" + extension;
//	alert("!"+msg+"!");
	document.getElementById('enlarge_link').href=msg;
//	alert("!"+document.getElementById('enlarge_link').href+"!");	
	}
//	else{
//	alert(arrVideos[currentVideoId].ImageL);
//	document.getElementById('enlarge_link').href = arrVideos[currentVideoId].ImageL;
//	alert(document.getElementById('enlarge_link').href = arrVideos[currentVideoId].ImageL);
//	}
}

function imageCollection(imageURL, imageAlt, imageDescription, imageWebsite, blurb, showlarger, visitsite, readcasestudy){
	
	this.URL = imageURL;
	this.Alt = imageAlt;
	this.Description = imageDescription;
	this.Site = imageWebsite;
	this.Blurb=blurb;
	this.showLarger = showlarger;
	this.visitSite=visitsite;
	this.readCaseStudy = readcasestudy;
	this.Type="1";
	
	this.changeType=function(newtype){
		this.Type=newtype;
	}
}

/*var arrImages = new Array();
arrImages["1"] = new imageCollection("images/portfolio/astleyclarke_screen.jpg", "Astley Clarke by Jellifish", "Jellifish have worked closely with award winning online retail Jeweller <strong>Astley Clarke</strong> over the years.  Developing conversion strategies, applying SEO techniques as well as developing ecommerce modules to growth their site along with the business.  Jellifish have supported <strong>Astley Clarke</strong> over the years, providing invaluable backup for this leading dot com.", "http://www.astleyclarke.com", "Astley Clarke are a major player in the upper echelons of the Jewellery market, providing quality Jewellery to high-end customers", true, true, true);
arrImages["2"] = new imageCollection("images/portfolio/poolenew_screen.jpg", "Poole Pottery by Jellifish", "Ceramics firm <strong>Poole Pottery</strong> commissioned Jellifish to design and build an ecommerce website that would stand proud in their competitive industry.  With an update to the <strong>Poole Pottery</strong> brand the website was launched and has continually been supported and developed by Jellifish as the company launch new ranges.", "http://www.poolepottery.co.uk", "Poole Pottery I know nothing about, so won't try to make anything up here", true, true, false);
arrImages["3"] = new imageCollection("images/portfolio/SOTcouncil_screen.jpg", "SOT council by Jellifish", "This project has grown from a Stoke on Trent based <strong>landlord accreditation</strong> scheme to take on board 5 other areas within Staffordshire. The scalability of this initial design has facilitated this growth and has enabled them to continue to become one of the most respected <strong>landlord accreditation</strong> schemes in the country.", "http://www.landlordaccreditation.co.uk", "Stoke on Trent City Council are a major Public Sector organization in the Midlands.", true, false, true);
arrImages["4"] = new imageCollection("images/portfolio/kelloggs_screen.jpg", "Kelloggs by Jellifish", "Jellifish have been partnering with London based Agency <strong>Max-TM</strong> on a  development project for a web based and desktop application to support a number of the business areas internally and intranet based within <strong>Kelloggs UK</strong> and overseas business.  The system is database driven and content managed using Flash with XML / ASP/ SQL Server and access some 3D modeling.", "", "Kelloggs are a multinational cereals firms, famous for such products as Cornflakes", false, true, true);
arrImages["5"] = new imageCollection("images/portfolio/JCB_screen.jpg", "JCB by Jellifish", "As the financial crisis hit in 2008, Jellifish approached <strong>JCB Finance</strong> with a proposed communication strategy to combat the decreasing confidence levels in commercial lending.  Jellifish were commissioned to distribute the 'Feeling the Pinch of the credit crunch?' enewsletter which linked through to an online corporate film reflecting the strength and support of <strong>JCB Finance</strong> during these troubling times.", "", "JCB Finance are one of the countries larges finance groups, provided fiscal help to a winde range of businesses.", true, false, false);
arrImages["6"] = new imageCollection("images/portfolio/tach_screen.jpg", "Tach by Jellifish", "<p>Jellifish have been approached by one of Bond Streets latest additions, <strong>TACH</strong>. As well as valuable experience and insight into the sector, Jellifish provided web design, illustration and photography services as part of the marketing support services utilised by this unique brand</p>", "http://www.tachltd.com", "No idea who Tach are, but they are somebody, and who they will appear here.", false, false, true);
arrImages["7"] = new imageCollection("images/portfolio/hallmark_screen.jpg", "Hallmark cabinets by Jellifish", "This established company approached Jellifish, looking for design, website and marketing services to transform this traditional business with skilled craftsmen and crafted cabinets, into something contemporary and appealing to a younger target audience as well as the existing market.", " http://www.hallmark-cabinets.co.uk", "Hallmark Cabinets are a market leader in te production quality cabinets for a wide spectrum of uses.", false, true, false);
arrImages["9"] = new imageCollection("images/portfolio/ifb_screen.jpg", "IFB by Jellifish", "Jellifish have clients and years of experience within both B2B and B2C sectors. <strong>International Freight Brokers Ltd</strong> commissioned Jellifish to design and develop their website that is used as a main communications tool to all stakeholders.", "http://www.ifb-ltd.com", "IFB, no idea who they are, so this will get filled in later.", false, false, false);
*/
function getData(pointer){
	
	document.getElementById('flashmovie').style.display="none"
	document.getElementById('enlarge_link').style.display="block"
	
	//document.getElementById('work_image2').innerHTML = pointer.defaultValue;
	document.getElementById('enlarge_link').href = arrImages[pointer.id].URL;
	document.getElementById('image_web').src = arrImages[pointer.id].URL;
	document.getElementById('image_web').alt = arrImages[pointer.id].Alt;
	document.getElementById('thumbDescription').innerHTML = arrImages[pointer.id].Blurb;
	
	document.getElementById('linkLargerMovie').style.display = "none";

	if(arrImages[pointer.id].showLarger){
		document.getElementById('linkLargerImage').style.display = "block";
	}
	else{
		document.getElementById('linkLargerImage').style.display = "none";	
	}
	
	if(arrImages[pointer.id].visitSite){
		document.getElementById('linkSite').style.display = "block";
		document.getElementById('aSite').href = arrImages[pointer.id].Site;
	}
	else{
		document.getElementById('linkSite').style.display = "none";	
	}
	
	if(arrImages[pointer.id].readCaseStudy){
		document.getElementById('linkCaseStudy').style.display = "block";
		document.getElementById('aCaseStudy').href = "case-studies.asp?study=" + pointer.id;
	}
	else{
		document.getElementById('linkCaseStudy').style.display = "none";	
	}
	
	
		
	subString = ".";
	//fullString = document.getElementById('image_web').src;
	//document.getElementById('enlarge_link').href = fullString.substring(0, fullString.lastIndexOf(subString)) + "_large" + fullString.substr(fullString.lastIndexOf('.'));
}

function videoCollection(videoURL, videoImageL, videoDescription, videoWebsite){
	
	this.URL = videoURL;
	this.ImageL = videoImageL;
	this.Description = videoDescription;
	this.Site = videoWebsite;
}

var arrVideos = new Array();
arrVideos["1"] = new videoCollection("<object width=\"371\" height=\"260\"><param name=\"wmode\" value=\"transparent\"></param><param name=\"movie\" value=\"http://www.youtube.com/v/bye2u7IN2Fw&color1=0xb1b1b1&color2=0xcfcfcf&fs=1\"></param><param name=\"allowFullScreen\" value=\"true\"></param><embed src=\"http://www.youtube.com/v/bye2u7IN2Fw&color1=0xb1b1b1&color2=0xcfcfcf&fs=1\" type=\"application/x-shockwave-flash\"  allowfullscreen=\"true\" width=\"371\" height=\"300\" mode=\"transparent\"></embed></object>", "images/portfolio/skinttariffs_screen_large.jpg", "An excellent example of the affiliate successes that Jellifish have produced over the years.  Awarded Best Website of the Year by the Carphone Warehouse Skinttariffs.com is  a prime example of how the affiliate marketing industry is growing and is an effective route to market for many retail businesses.  Jellifish have also produced a video as part of a viral marketing campaign to promote the site.", "http://www.skinttariffs.com");

function getVideo(pointer){
	/*document.getElementById('work_image').innerHTML = arrVideos[pointer.id].URL;
	document.getElementById('description').innerHTML = arrVideos[pointer.id].Description;
	if (arrVideos[pointer.id].Site != "")
	{	//alert("Making View Site Visible");
		document.getElementById('view_site_text').style.display = "block";
		document.getElementById('view_site').href = arrVideos[pointer.id].Site;
	}
	else
		document.getElementById('view_site_text').style.display = "none";
	
	currentVideoId = pointer.id;*/

	document.getElementById('flashmovie').style.display="block"
	document.getElementById('enlarge_link').style.display="none"
	
	document.getElementById('enlarge_link').href = arrImages[pointer.id].URL;
	//document.getElementById('flashlink').href = arrImages[pointer.id].URL;
	
	document.getElementById('thumbDescription').innerHTML = arrImages[pointer.id].Blurb;
	
	swfobject.embedSWF(arrImages[pointer.id].URL, "flashmovie", "260", "210", "9.0.0", "expressInstall.swf", false, {wmode:"transparent", allowFullScreen:"true"}, {rel:"lighbox"});
	
	document.getElementById('linkLargerImage').style.display = "none";	
	
	if(arrImages[pointer.id].showLarger){
		document.getElementById('linkLargerMovie').style.display = "block";
	}
	else{
		document.getElementById('linkLargerMovie').style.display = "none";	
	}
	
	if(arrImages[pointer.id].visitSite){
		document.getElementById('linkSite').style.display = "block";
		document.getElementById('aSite').href = arrImages[pointer.id].Site;
	}
	else{
		document.getElementById('linkSite').style.display = "none";	
	}
	
	if(arrImages[pointer.id].readCaseStudy){
		document.getElementById('linkCaseStudy').style.display = "block";
		document.getElementById('aCaseStudy').href = "case-studies.asp?study=" + pointer.id;
	}
	else{
		document.getElementById('linkCaseStudy').style.display = "none";	
	}
}






/**AJAX
var XMLHttpRequestObject = false;
if (window.XMLHttpRequest)
{
	var XMLHttpRequestObject1 = new XMLHttpRequest();
	var XMLHttpRequestObject2 = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
	var	XMLHttpRequestObject1 = new ActiveXObject("Microsoft.XMLHTTP");
	var	XMLHttpRequestObject2 = new ActiveXObject("Microsoft.XMLHTTP");
	
}

var XMLHttpRequestObject = false;
if (window.XMLHttpRequest)
{
	var XMLHttpRequestObject1 = new XMLHttpRequest();
	var XMLHttpRequestObject2 = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
	var	XMLHttpRequestObject1 = new ActiveXObject("Microsoft.XMLHTTP");
	var	XMLHttpRequestObject2 = new ActiveXObject("Microsoft.XMLHTTP");
	
}




function getDescription()
{
//	alert("In getDescription")
	var obj1 = document.getElementById('description')
	XMLHttpRequestObject1.open("GET", '../uat/description.txt')
//	XMLHttpRequestObject1.open("GET", '../uat/ajax.asp')
	XMLHttpRequestObject1.send(null)
	XMLHttpRequestObject1.onreadystatechange = function()
	{
		alert("Description State changed")
		if (XMLHttpRequestObject1.readyState == 4 && XMLHttpRequestObject1.status == 200)
		{
			alert("Description Loaded")
			obj1.innerHTML = XMLHttpRequestObject1.responseText
//			alert("Description written")
		}
	}
//	alert("getting out of Description")
}
function getImage()
{
//	alert("In getImage")
	var obj2 = document.getElementById('image')
	XMLHttpRequestObject2.open("GET", '../uat/image.txt')
//	XMLHttpRequestObject2.open("GET", '../uat/ajax.asp')
	XMLHttpRequestObject2.send(null)
	XMLHttpRequestObject2.onreadystatechange = function()
	{
		alert("Image State changed")
		if (XMLHttpRequestObject2.readyState == 4 && XMLHttpRequestObject2.status == 200)
		{
			alert("Image data loaded")
			obj2.src = XMLHttpRequestObject2.responseText
//			alert("Image data written")
		}
	}
//	alert("getting out of getImage")
}

function getData(id)
{
//	alert("In getData")
//	getDescription()
//	getImage()
//	alert
//alert("in jQuery");
jQuery.noConflict();
jQuery.ajax(
{	
    url: 'ajax.asp',
    dataType: 'text',
	type: 'POST',
	data: "id="+id,	
    timeout: 1000,
    error: function(obj,msg)
	{
        alert('Error loading ajax document: ' + msg);
    },
    success: function(text)
	{
	
		document.getElementById('image').src = text;
//		alert(text);
    }
}
);
}
**/
