function a(){

}

function talktous(){


document.location='mailto:design@specialistglassco.co.uk?subject=web enquiry' ;
}



function initialiseHovers(){


	
// add dynamic plugin with optional configuration for bottom edge
//}).dynamic({ bottom: { direction: 'down', bounce: true } });


	/*$("#macrotn1").tooltip({ offset: [90, -250  ], effect: 'slide'}).dynamic({ bottom: { direction: 'down', bounce: true } });
	$("#macrotn2").tooltip({ offset: [90, -250  ], effect: 'slide'}).dynamic({ bottom: { direction: 'down', bounce: true } });
	$("#macrotn3").tooltip({ offset: [90, -250  ], effect: 'slide'}).dynamic({ bottom: { direction: 'down', bounce: true } });
	$("#macrotn4").tooltip({ offset: [90, -250  ], effect: 'slide'}).dynamic({ bottom: { direction: 'down', bounce: true } });
	$("#macrotn5").tooltip({ offset: [90, -250  ], effect: 'slide'}).dynamic({ bottom: { direction: 'down', bounce: true } });
	$("#macrotn6").tooltip({ offset: [90, -250  ], effect: 'slide'}).dynamic({ bottom: { direction: 'down', bounce: true } });
	*/
	
	
	$("#macrotn1").each(function(){  
	        var el = $(this);  
			
			
	        el.tooltip({  
	            position: 'bottom center',  
	            offset : [0, 0],    
	            tip : '#'+el.attr('title')  
	        }); 

			if (this.getTrigger().attr('title') != '') {
				this.getTip().text( this.getTrigger().attr('title') );
			}
	    });


	
}


/* changeMacros( 'traditional', 'Blue Squirls', '1' ) */
function changeMacros( categoryName, projectName, projectNo ){

	var projectTitleDiv = document.getElementById('projectTitle');
		
	if (projectTitleDiv){		
		projectTitleDiv.innerHTML = '<b>Macro Images </b> &nbsp;' + projectName;
	}	

	for (var loop= 1; loop < 7; loop++ ){
	
		var divvie = document.getElementById( 'macrotn' + loop);
		
		if (divvie){		
		
			// need to change background images of div using css
			var backgroundImage = "background:url( \'images/" + categoryName + "/" + projectNo + "/htn" + loop + ".png \');";			
			//alert( backgroundImage);
			divvie.setAttribute('style', backgroundImage);
			
			//set title attribute
			
			//href="images/traditional/1/1.png"
			var title = 'images/' + categoryName + '/' + projectNo + '/' + loop + '.jpg';			
			//alert( title);
			divvie.setAttribute('href', title);	
			//alert( 'get Attribute' + divvie.getAttribute('title'));
	
		}
	}	
		
	//initialiseHovers();
	
	
	//<a href="images/traditional/1/1.png" class="highslide" onclick="return hs.expand(this)">
	//							<img src="images/traditional/1/htn1.png" alt="image" title="Click to enlarge"  />
	//						</a>

/*
html =
title="<img class='hoverImage' src='images/hover/14.png'/>"
			
						<div class="macrotn" id="macrotn1"  ></div>
						<div class="macrotn" id="macrotn2"></div>
						<div class="macrotn" id="macrotn3"></div>
						<div class="macrotn" id="macrotn4"></div>
						<div class="macrotn" id="macrotn5"></div>
						<div class="macrotn" id="macrotn6"></div>

*/


}


function validateContactUs(){


	var form = document.getElementById('contactme');
	
	if (form){	
	
		var validate = false; 
		

		if ( 	validateName(document.getElementById('contactName')) == false ||
				validatePhone(document.getElementById('tel'))  == false ||
				validateEmail( document.getElementById('contactEmail') )  == false 
				
		){
		
			 validate = false; 
			 document.getElementById('errorMessage').style.display='block';
			 
			 //alert('bad form');
			 
		
		}
		else{
		
			 validate = true; 
			 document.getElementById('errorMessage').style.display='none';
		}
		

	
		if (validate == true ){
			form.action="http://www.specialistglassco.co.uk/contact.php";
			form.submit();
			//alert('good form');
		}
	}
	
	
	


}

/* */

function validateSource(fld) {

	var validate = false; 

    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    
      
    if (fld.value == "") {
        fld.style.background = '#e82372';
        //error = "You didn't enter an email address.\n";
    } else if (fld.value == "Please Select") {
        fld.style.background = '#e82372';
        //error = "The email address contains illegal characters.\n";
    } else {
        fld.style.background = 'white';
		validate = true;
		
    }
    return validate;
}


function validateName(fld) {

	var validate = false; 

    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
   
    if (fld.value == "") {
        fld.style.background = '#e82372';
        //error = "You didn't enter an email address.\n";
    } else if (fld.value.match(illegalChars)) {
        fld.style.background = '#e82372';
        //error = "The email address contains illegal characters.\n";
    } else {
        fld.style.background = 'white';
		validate = true;
		
    }
    return validate;
}




function validateEmail(fld) {

	var validate = false; 

    var error="";
    var tfld = trim(fld.value);                        // value of field with whitespace trimmed off
    var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
    var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
   
    if (fld.value == "") {
        fld.style.background = '#e82372';
        //error = "You didn't enter an email address.\n";
    } else if (!emailFilter.test(tfld)) {              //test email for illegal characters
        fld.style.background = '#e82372';
        //error = "Please enter a valid email address.\n";
    } else if (fld.value.match(illegalChars)) {
        fld.style.background = '#e82372';
        //error = "The email address contains illegal characters.\n";
    } else {
        fld.style.background = 'white';
		validate = true;
		
    }
    return validate;
}



function validatePhone(fld) {


	var validate = false; 
    var error = "";
    var stripped = fld.value.replace(/[\(\)\.\-\ ]/g, '');    

   if (fld.value == "") {
        //error = "You didn't enter a phone number.\n";
        fld.style.background = '#e82372';
    } else if (isNaN(parseInt(stripped))) {
        //error = "The phone number contains illegal characters.\n";
        fld.style.background = '#e82372';
    } else if (!(stripped.length > 10)) {
        //error = "The phone number is the wrong length. Make sure you included an area code.\n";
        fld.style.background = '#e82372';
    }
	else{
			fld.style.background = 'white';
			validate = true;
	}
     return validate;
}



// ==========================================================================
// Fuctions to mimic LTrim, RTrim, and Trim...

// Author          Aurélien Tisné	(CS)
// Date            03 avr. 2003 23:11:39
// Last Update     $Date$
// Version         $Revision$
// ==========================================================================

// --------------------------------------------------------------------------
// Remove leading blanks from our string.

// I               str - the string we want to LTrim
// Return          the input string without any leading whitespace

// Date            03 avr. 2003 23:12:13
// Author          Aurélien Tisné	(CS)
// --------------------------------------------------------------------------
function LTrim(str)
{
  var whitespace = new String(" \t\n\r");

  var s = new String(str);

  if (whitespace.indexOf(s.charAt(0)) != -1) {
    // We have a string with leading blank(s)...

    var j=0, i = s.length;

    // Iterate from the far left of string until we
    // don't have any more whitespace...
    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
    j++;


    // Get the substring from the first non-whitespace
    // character to the end of the string...
    s = s.substring(j, i);
  }

  return s;
}

// --------------------------------------------------------------------------
// Remove trailing blanks from our string.

// I               str - the string we want to RTrim
// Return          the input string without any trailing whitespace

// Date            03 avr. 2003 23:13:50
// Author          Aurélien Tisné	(CS)
// --------------------------------------------------------------------------
function RTrim(str)
{
  // We don't want to trip JUST spaces, but also tabs,
  // line feeds, etc.  Add anything else you want to
  // "trim" here in Whitespace
  var whitespace = new String(" \t\n\r");

  var s = new String(str);

  if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
    // We have a string with trailing blank(s)...

    var i = s.length - 1;       // Get length of string

    // Iterate from the far right of string until we
    // don't have any more whitespace...
    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
      i--;


    // Get the substring from the front of the string to
    // where the last non-whitespace character is...
    s = s.substring(0, i+1);
  }

  return s;
}


// --------------------------------------------------------------------------
// Remove trailing and leading blanks from our string.

// I               str - the string we want to Trim
// Return          the trimmed input string

// Date            03 avr. 2003 23:15:09
// Author          Aurélien Tisné	(CS)
// --------------------------------------------------------------------------
function trim(str)
{
	
  return RTrim(LTrim(str));
}

// EOF




