
// addthis account

var addthis_pub="kchoppin";

function display_email(){

document.write('<a href="mailto:');
document.write('me');
document.write('@');
document.write('kevinchoppin.co.uk');
document.write('">');
document.write('me');
document.write('@');
document.write('kevinchoppin.co.uk');
document.write('</a>');

}

function jq_img_load(id,title,img){

if(id == 3 || id == 19 || id == 6 || id == 18 || id == 21 || id == 25 || id == 29 || id == 33 || id == 37 || id == 41 || id == 45){
// first of a row...
// dirty statement I know but if I get more projects than this then i'm rich and can afford the time to build a better solution...
style =  ' style="margin-left: 0px;"';
}

else{
style = '';
}

document.write('<'+'a title="'+title+'" id="project_'+id+'">'+'<'+'img src="images/'+img+'.gif" alt="" '+style+'/>'+'<'+'/a'+'>');

return true;

}

$(document).ready(function(){

// display email address
var tempContactList = document.getElementById("contactList").innerHTML;
document.getElementById("contactList").innerHTML = '<li><img src="/images/email.gif" alt="Email" title="Email" /> <a href="ma'+'ilto'+':me'+'@'+'kevin'+'choppin'+'.co.uk'+'">'+'me'+'@'+'kevin'+'choppin'+'.co.uk</a></li>'+tempContactList;

// dialog boxes

var dialog_1 = $("#dialog_1");
var dialog_2 = $("#dialog_2");
var dialog_3 = $("#dialog_3");
var dialog_4 = $("#dialog_4");

var dialog_5 = $("#dialog_5");
var dialog_14 = $("#dialog_14");
var dialog_17 = $("#dialog_17");
var dialog_18 = $("#dialog_18");

if(document.getElementById("dialog_img_6")){

var dialog_6 = $("#dialog_6");
var dialog_7 = $("#dialog_7");
var dialog_8 = $("#dialog_8");

var dialog_9 = $("#dialog_9");
var dialog_10 = $("#dialog_10");
var dialog_11 = $("#dialog_11");
var dialog_12 = $("#dialog_12");

var dialog_13 = $("#dialog_13");
var dialog_15 = $("#dialog_15");
var dialog_16 = $("#dialog_16");

var dialog_19 = $("#dialog_19");

}

$("#dialog_img_1").css("display","block");
$("#dialog_img_2").css("display","block");
$("#dialog_img_3").css("display","block");
$("#dialog_img_4").css("display","block");

$("#dialog_img_5").css("display","block");
$("#dialog_img_14").css("display","block");
$("#dialog_img_17").css("display","block");
$("#dialog_img_18").css("display","block");

if(document.getElementById("dialog_img_6")){

$("#dialog_img_6").css("display","block");
$("#dialog_img_7").css("display","block");
$("#dialog_img_8").css("display","block");

$("#dialog_img_9").css("display","block");
$("#dialog_img_10").css("display","block");
$("#dialog_img_11").css("display","block");
$("#dialog_img_12").css("display","block");

$("#dialog_img_13").css("display","block");
$("#dialog_img_15").css("display","block");
$("#dialog_img_16").css("display","block");

$("#dialog_img_19").css("display","block");

}

dialog_1.css("display","none");
dialog_2.css("display","none");
dialog_3.css("display","none");
dialog_4.css("display","none");

dialog_5.css("display","none");
dialog_14.css("display","none");
dialog_17.css("display","none");
dialog_18.css("display","none");

if(document.getElementById("dialog_img_6")){

dialog_6.css("display","none");
dialog_7.css("display","none");
dialog_8.css("display","none");

dialog_9.css("display","none");
dialog_10.css("display","none");
dialog_11.css("display","none");
dialog_12.css("display","none");

dialog_13.css("display","none");
dialog_15.css("display","none");
dialog_16.css("display","none");

dialog_19.css("display","none");

}

$("a#project_1").click(function() {
	var dialogObj1 = dialog_1.dialog({
	title:'Remortgage Made Easy!',
	width:560,
	close:function(){
	dialogObj1.dialog("destroy");
	}
	});
});

$("a#project_2").click(function() {
	var dialogObj2 = dialog_2.dialog({
	title:'HousePals',
	width:560,
	close:function(){
	dialogObj2.dialog("destroy");
	}
	});
});

$("a#project_3").click(function() {
	var dialogObj3 = dialog_3.dialog({
	title:'Traffic Online Marketing',
	width:560,
	close:function(){
	dialogObj3.dialog("destroy");
	}
	});
});

$("a#project_4").click(function() {
	var dialogObj4 = dialog_4.dialog({
	title:'COLT Inner Circle',
	width:560,
	close:function(){
	dialogObj4.dialog("destroy");
	}
	});
});

$("a#project_5").click(function() {
	var dialogObj5 = dialog_5.dialog({
	title:'Emerging Real Estate',
	width:560,
	close:function(){
	dialogObj5.dialog("destroy");
	}
	});
});


$("a#project_14").click(function() {
	var dialogObj14 = dialog_14.dialog({
	title:'Hinchliffes Farm',
	width:560,
	close:function(){
	dialogObj14.dialog("destroy");
	}
	});
});


$("a#project_17").click(function() {
	var dialogObj17 = dialog_17.dialog({
	title:'Easypave',
	width:560,
	close:function(){
	dialogObj17.dialog("destroy");
	}
	});
});


$("a#project_18").click(function() {
	var dialogObj18 = dialog_18.dialog({
	title:'Birmingham Law Society',
	width:560,
	close:function(){
	dialogObj18.dialog("destroy");
	}
	});
});

if(document.getElementById("dialog_img_6")){

$("a#project_6").click(function() {
	var dialogObj6 = dialog_6.dialog({
	title:'Three Sixty Systems',
	width:560,
	close:function(){
	dialogObj6.dialog("destroy");
	}
	});
});

$("a#project_7").click(function() {
	var dialogObj7 = dialog_7.dialog({
	title:'Robin Simon LLP',
	width:560,
	close:function(){
	dialogObj7.dialog("destroy");
	}
	});
});

$("a#project_8").click(function() {
	var dialogObj8 = dialog_8.dialog({
	title:'Douglas Delabie',
	width:560,
	close:function(){
	dialogObj8.dialog("destroy");
	}
	});
});

$("a#project_9").click(function() {
	var dialogObj9 = dialog_9.dialog({
	title:'Shepley Spring Festival',
	width:560,
	close:function(){
	dialogObj9.dialog("destroy");
	}
	});
});

$("a#project_10").click(function() {
	var dialogObj10 = dialog_10.dialog({
	title:'Risk Management Consultants',
	width:560,
	close:function(){
	dialogObj10.dialog("destroy");
	}
	});
});

$("a#project_11").click(function() {
	var dialogObj11 = dialog_11.dialog({
	title:'Absolute Hospitality',
	width:560,
	close:function(){
	dialogObj11.dialog("destroy");
	}
	});
});

$("a#project_12").click(function() {
	var dialogObj12 = dialog_12.dialog({
	title:'UK Response',
	width:560,
	close:function(){
	dialogObj12.dialog("destroy");
	}
	});
});

$("a#project_13").click(function() {
	var dialogObj13 = dialog_13.dialog({
	title:'Brewfitt Direct',
	width:560,
	close:function(){
	dialogObj13.dialog("destroy");
	}
	});
});

$("a#project_15").click(function() {
	var dialogObj15 = dialog_15.dialog({
	title:'Sinks-Taps.com',
	width:560,
	close:function(){
	dialogObj15.dialog("destroy");
	}
	});
});

$("a#project_16").click(function() {
	var dialogObj16 = dialog_16.dialog({
	title:'WS North',
	width:560,
	close:function(){
	dialogObj16.dialog("destroy");
	}
	});
});

$("a#project_19").click(function() {
	var dialogObj19 = dialog_19.dialog({
	title:'ICE Oxford',
	width:560,
	close:function(){
	dialogObj19.dialog("destroy");
	}
	});
});

}

// form validation

	var errorTxt = '';
	var valError = 0;

// end of dom ready
});

function valForm(form_ref){

	valError = 0;

	var errorTxt='<p>Please correct the following errors;</p><ul>';

if(form_ref == 'contact_form'){

var nameField = document.getElementById('name').value;
var phoneField = document.getElementById('phone').value;
var messageField = document.getElementById('message').value;
var captchaField = document.getElementById('captcha').value;

	if(nameField.length == 0){
	errorTxt+='<li>Please enter your name</li>';
	valError = 1;
	}

	if(phoneField.length == 0 && document.getElementById('email').value.length == 0){
	errorTxt+='<li>Please enter your email address or telephone number</li>';
	valError = 1;
	}

	if(messageField.length == 0){
	errorTxt+='<li>Please enter your message</li>';
	valError = 1;
	}

	if(captchaField.length == 0){
	errorTxt+='<li>Please enter the security code</li>';
	valError = 1;
	}

}

if(form_ref == 'link_exchange'){


	if(document.getElementById('company').value.length == 0){
	errorTxt+='<li>Please enter your company name</li>';
	valError = 1;
	}

	if(document.getElementById('email').value.length == 0){
	errorTxt+='<li>Please enter your email address</li>';
	valError = 1;
	}

	if(document.getElementById('website').value.length == 0){
	errorTxt+='<li>Please enter your website link</li>';
	valError = 1;
	}

	if(document.getElementById('reciprocal').value.length == 0){
	errorTxt+='<li>Please enter the page of your reciprocal link</li>';
	valError = 1;
	}

	if(document.getElementById('captcha').value.length == 0){
	errorTxt+='<li>Please enter the security code</li>';
	valError = 1;
	}

}

	errorTxt+='</ul>';

	if(valError == '1'){

	document.getElementById('errorTxt').innerHTML = errorTxt;

	var errorDiv = $("#errorTxt");

	var dialogObj1 = errorDiv.dialog({
	title:'Form error!',
	width:350,
	modal: true,
	resizable: false,
	buttons:{OK:function(){dialogObj1.dialog("destroy");}},
	close:function(){dialogObj1.dialog("destroy");}
	});

	}

	else{
	document.forms[form_ref].submit();
	}

}

function contactButton(form_ref){

document.write('<a onclick="return valForm(\''+form_ref+'\');" style="cursor: pointer;"><img src="images/submit-button.gif" alt="Send" /></a>');

}