/* 
janpro.js: library of javascript for animation / branding effects
    david.kelly@fanore.com (http://www.fanore.com/website_design.htm)
    
  setup_page: triggered when the page has completed loading
  fix_height: ensure that page reaches to bottom of the viewport  
  load_map: populate and initialise Google map
  submit_form: utility that will perform client side validation of the passed form id and allow validator to post it   
  open_link: used to open a new window full screen  
  validate_search: tests the search dialogue before posting      
*/

var gallery=false;

jQuery(document).ready(function($){setup_page();});

//  setup_page: triggered when the page has completed loading
function setup_page(){
    // preload images
    //$('#content').fadeOut(100);
    if ($('#image_payload').length){  
        var buffer=$('#image_payload').val();
        var url=$('#u_base').val() + 'images/'
        if (buffer.lenght!=0){
            gallery=new make_gallery(url,buffer, 'gallery_image');
        }
    }
    
    if ($('#map').length){
        eval('load_map("map");');
    }
    if ($('#large_map').length){
        eval('load_map("large_map");');
    }
    
     if ($("#browsable").length){
    	 $("#browsable").scrollable({
            size: 3
         }).navigator().circular().autoscroll({ 
                steps: 1, 
                interval: 3000         
            });
            
         setup_images();
     } 
  
    outbound_links()
    fix_height();
    jQuery('ul.sf-menu').supersubs({ 
            minWidth:    2,   // minimum width of sub-menus in em units 
            maxWidth:    18,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }).superfish();  // superfish();
        

        
        
    //Full Caption Sliding (Hidden to Visible)
    $('.boxgrid.captionfull').hover(function(){
    	$(".cover", this).stop().animate({top:'0'},{queue:false,duration:460});
    }, function() {
    	$(".cover", this).stop().animate({top:'110px'},{queue:false,duration:160});
    });
          
     //uk map
     if ($('#ukmapping').length){
        eval('uk_map();');
     }     
   // $('div.flash_object').bind('mousemove',function(){manage_flash(0)});      
            
            
}

function manage_flash(e){
 if (e==0){
     $('div.flash_object').hide();
 }
 else
 {      if ($('div.sf-wrapper ul li ul').css('display')=='block'){return void[0];} 
        $('div.flash_object').show();   }
}  

function setup_images(){
$(".items img").click(function() {
 
	// calclulate large image's URL based on the thumbnail URL 
	var url = $(this).attr("src").replace("thumb_", "");
 
	// get handle to element that wraps the image and make it semitransparent
	var wrap = $("#image_wrap").fadeTo("medium", 0.5);
 
	// the large image 
	var img = new Image();
 
	// call this function after it's loaded
	img.onload = function() {
 
		// make wrapper fully visible
		wrap.fadeTo("medium", 1);
 
		// change the image
		wrap.find("img").attr("src", url);
 
	};
 
	// begin loading the image 
	img.src = url;
 
// when page loads simulate a "click" on the first image
}).filter(":first").click();

}


//outbound_links: ensure that outbound links open in a new window
function outbound_links(){
    $("a", "#page_container").bind("click", function(event){  
    var b=$('#u_base').val();
    var href=$(this).attr("href").toString();
        if ((href.indexOf(b)==-1)&&(href.indexOf('javascript')==-1)&&(href.indexOf('mailto')==-1)&&(href.indexOf('../')==-1)){
            var n_ref='javascript: open_link(\'' + href + '\');';
            $(this).attr("href",n_ref);
         }
    });     
    
}


function update_content(param_url){
        // hide content
        $('#content').fadeOut(200);
$("#content").load(param_url,'',function(){
       if ($('#map').length){
       $('#content').fadeIn(500);
        eval('load_map();');
         
        }
        else{
        $('#content').fadeIn(500,function(){
            $('#content').fadeTo('normal',0.8);
        });
        }
            });
            return void[0];
}

//      fix_height: ensure that page reaches to bottom of the viewport
function fix_height(){
 
    var h=$(window).height()-413
    var d=$(document).height()-413
    if (d > h){h=d}
    if (($('div.www_content').height()) < h){
       $('div.www_content').height(h);
    }
    else{
       $('div.www_content').height('auto');    
    }
    
    
}

//  load_map: populate and initialise Google map
function load_map() {
//  alert("map")
    var lat=53.08776129009672;
    var lon=-9.314088821411132;
    var c_lat=53.10062087921428;
    var c_lon=-9.29443359375;
    if (GBrowserIsCompatible()) {
        var map = new GMap(document.getElementById("map"));
        map.addControl(new GLargeMapControl())
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(c_lat, c_lon), 7);
        //var blueIcon = new GIcon(G_DEFAULT_ICON);
        //blueIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";        		
        var html=''
        var point = new GPoint(parseFloat(lon), parseFloat(lat));
        var marker = new GMarker(point);
        var icon = new GIcon(G_DEFAULT_ICON);
        icon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
        icon.iconSize = new GSize(20,20);
        icon.iconAnchor = new GPoint(10,20);
        icon.infoWindowAnchor = new GPoint(10, 20);
        var marker = new GMarker(point,icon);   
        //GEvent.addListener(marker, "mouseover", function() {
        //marker.openInfoWindowHtml(html);
        //});
        map.addOverlay(marker);
        return marker
    }
 }








//  submit_form: utility that will perform client side validation of the passed form id and allow validator to post it 
function submit_form(param_form){
    var el=get_el("cs_validation");
    //alert("here");
    if (el){
        var f=$(param_form)
        var cs_validation=f['cs_validation'];
         return eval($(cs_validation).getValue());
    }
    else{
        $(param_form).submit();
    }
}

//  open_link: used to open a new window full screen
function open_link(url){
 var settings='Height=' + screen.height + ',Width=' + screen.width + ',Top=0,left=0,scrollbars=yes,resizable=1, location=1,status=1'
 var w=window.open(url,'janpro',settings);    
}


// validate_registration_form: test the values entered on registration form
function validate_registration_form(){
//organisation
    if ($('#txt_organisation').val().length==0){
         show_error_message("please enter the company or organisation name!",'error_message_panel');
        $('#txt_organisation').focus();
        return false;
    }
//title
   // if ($('#txt_title').val().length==0){
   //      show_error_message("please enter the contact title (e.g. Mr. / Ms.)!",'error_message_panel');
   //     $('#txt_title').focus();
   //     return false;
   // }
//firstname
    if ($('#txt_firstname').val().length==0){
         show_error_message("please enter the billing contact's first name!",'error_message_panel');
        $('#txt_firstname').focus();
        return false;
    }
//surname
    if ($('#txt_surname').val().length==0){
         show_error_message("please enter the billing contact's surname!",'error_message_panel');
        $('#txt_surname').focus();
        return false;
    }
//email
    if ($('#txt_email').val().length==0){
         show_error_message("please enter the billing email address!",'error_message_panel');
        $('#txt_email').focus();
        return false;
    }
//validate email address
    var e=$('#txt_email').val();
	if (!check_email(e,true)){
		show_error_message("The email address you have entered seems to be invalid - this system only supports the format 'yourname@address.com' !",'error_message_panel');
        $('#txt_email').focus();
		return false;
	}
    
//address 1
    if ($('#txt_address1').val().length==0){
         show_error_message("please enter at least two lines for the address!",'error_message_panel');
        $('#txt_address1').focus();
        return false;
    }
//address 2
    if ($('#txt_address1').val().length==0){
         show_error_message("please enter at least two lines for the address!",'error_message_panel');
        $('#txt_address1').focus();
        return false;
    }
//address 3
//    if ($('#txt_address3').val().length==0){
//         show_error_message("please enter at least two lines for the address!",'error_message_panel');
//        $('#txt_address3').focus();
//        return false;
//    }
//address 4 (county)
    if ($('#txt_address4').val().length==0){
         show_error_message("please select the county!",'error_message_panel');
        $('#txt_address4').focus();
        return false;
    }
//telephone
    if ($('#txt_telephone').val().length==0){
         show_error_message("please enter a contact telephone number!",'error_message_panel');
        $('#txt_telephone').focus();
        return false;
    }
//mobile
//    if ($('#txt_mobile').val().length==0){
//         show_error_message("please enter a mobile number!",'error_message_panel');
//        $('#txt_mobile').focus();
//        return false;
//    }
//fax
//    if ($('#txt_fax').val().length==0){
//         show_error_message("please enter a fax number!",'error_message_panel');
//        $('#txt_fax').focus();
//        return false;
//    }
//vat number
//    if ($('#txt_vat').val().length==0){
//         show_error_message("please enter a vat number!",'error_message_panel');
//        $('#txt_vat').focus();
//        return false;
//    }
return true;
}


function show_error_message(param_message,param_wrapper, param_div){
alert(param_message);
return void[0];
    if (param_div==false){
        alert(param_message);
    }
    else{
            $('#display_error_message').innerHTML=param_message;
            //$(param_wrapper).absolutize();
            //$(param_wrapper).setStyle({top: 200, left:400, zIndex:100});
            $('#display_error_message').show('slow');
            setTimeout(function(){hide_error_message(param_wrapper)},2000);
/*
            new Effect.Appear(param_wrapper,{
                duration: 0.5, 
                afterFinish: function(){
                setTimeout(function(){hide_error_message(param_wrapper)},2000);
            }});
*/            
    }
}
// hide the error message panel
function hide_error_message(param_wrapper){
    
        $('#' + param_wrapper).hide('slow');

}



function validate_form(){
//    alert('here');
    
    //txt_name
    if ($('#txt_name').val().length==0){
        alert("Please enter a contact name!");
        $('#txt_name').focus();
        return false;
    }
    
    //telephone
    var telephone=fix_telephone($('#txt_telephone').val());
    $('#txt_telephone').val(telephone);
    
    if (telephone.length==0){
        alert("Please enter a contact telephone number!");
        $('#txt_telephone').focus();
        return false;
    }

    //email address
    if ($('#txt_email').val().length==0){
        alert("Please enter a contact email address!");
        $('#txt_email').focus();
        return false;
    }
    var e=$('#txt_email').val();
    if (!check_email(e,true)){
        alert("Please check that you have entered a valid  email address!");
        $('#txt_email').focus();
        return false;
    }
    //postcode
    if (($('#postcode').val().length==0)||($('#postcode').val().length<4)){
        alert("Please enter your postcode!");
        $('#postcode').focus();
        return false;
    }
    
    //nature of enquiry
    if (jQuery.trim($('#nature').val()).length==0){
        show_error_message("Please select the nature of your enquiry!",'error_message_panel');
        $('#nature').focus();
        return false;
    }    
    
    //message
    if ($('#txt_comment').val().length==0){
        alert("Please tell us how we can assist!");
        $('#txt_comment').focus();
        return false;
    }
    
    $('#your_details').val('');
    //
    
    return true;
 }
 



function check_email(svalue, bmail){
    var str=svalue;
    var sinvalid="!,£,\$,%,',\&";
    
    if (bmail==true){
    	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(')|(%)|(")/; // not valid
    	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
    }
    else{
    	var reg1 = /(\.\.)|(^\.)|(')|(%)|(")/; // not valid
    	var reg2 = /([a-zA-Z0-9])|([a-zA-Z])|([0-9])/; // valid
    
    }
    if (!reg1.test(str) && reg2.test(str)) { // if syntax is valid
    	return true;
    	}
    return false;
}



//fix_telephone: removes non-numeric characters from user entry
function fix_telephone(param_value){
    var ret_value='';
    var wip_value=param_value;
    var a_values='1234567890'
    //alert(wip_value.length);
    for (var i=0;i<=wip_value.length;i++){
    //alert(wip_value.charAt(i))
        for (var x=0;x<=a_values.length;x++){
            if (wip_value.charAt(i)==a_values.charAt(x)){
                ret_value+=wip_value.charAt(i)
            }
        }
    } 
    //alert(ret_value);
    return ret_value;   
}

//make_gallery: construct javascript object for animation of gallery
function make_gallery(param_url,param_images, param_target){
    this.url=param_url
    this.contents=new Array;
    this.current=0;
    this.target=param_target
    this.next=next_gallery_image
    this.start=start_gallery_animation
    this.update=show_current_image
    var b=param_images.split(',');
    for (var i=0;i < b.length;i++){
        var img=new Image 
        img.src=this.url + b[i]; 
        this.contents[this.contents.length]=img.src 
        if (i==1){
            this.start();
        }
    }
    return this;
}

function next_gallery_image(){

    var i=this.contents.length;
    this.current++
    if (this.current==i){
        this.current=0;
    }
    return this.contents[this.current]
}

function start_gallery_animation(){
					$('ul#image_gallery').innerfade({
						speed: 2000,
						timeout: 10000,
						type: 'sequence',
						containerheight: '336px'
					});
					$('li','#image_gallery').removeClass('no_show');
    
  //  setTimeout(function(){
  //      gallery.update();
  //  },3000)
}

function show_current_image(){
    var src=this.next();
    //alert(this.target);
    $('#' + this.target).attr('src',src);
    setTimeout(function(){
        gallery.update();
    },3000)
}

//searchUKCleaning: check that a valid postcode has been entered
function searchUKCleaning(){
    var c=$('#postcode').val();
    if (c.length==0){
        alert('Please enter your post code');
        $('#postcode').focus();
        return false;
    }
    
}


//searchCleaning: execute user search
function searchCleaning(){
    var uid=$('#county').val();
    
    var url=$('#u_base').val() + 'asp/ajax.asp?z=cresults&county=' + uid 
    
//setup the dialogue caption
    $('#results').load(url, function(){
        
//display the modal dialogue
        var api=$("#results").overlay({
        	// some expose tweaks suitable for facebox-looking dialogs
            effect: 'apple',
            speed: 'fast',
        	expose: {
        		// you might also consider a "transparent" color for the mask
        		color: '#000',
        		// load mask a little faster
        		loadSpeed: 200,
        		// highly transparent
        		opacity: 0.5
        	},
        	// disable this for modal dialog-type of overlays
        	closeOnClick: true,
        	// we want to use the programming API
        	api: true
        // load it immediately after the construction
        });
        api.onBeforeLoad(function(){manage_flash(0);});
        api.onLoad(
        function(){
            cleaner_map();
           $('div.wrapContents a','#results').bind('click',function(){
//                alert(this.attr('class'));
                
            })
        });
         api.onBeforeClose(function(){manage_flash(1);});
        api.load();
 });   
return false;
    
}


//  cleaner_map: populate and initialise Google map
function cleaner_map() {
    var lat=53.54030739150022;
    var lon=-7.88543701171875;
    var c_lat=53.10062087921428;
    var c_lon=-9.29443359375;
    
    
    if (GBrowserIsCompatible()) {
        var map = new google.maps.Map2(document.getElementById("cmap"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl())
        map.setCenter(new google.maps.LatLng(lat, lon), 6);
        map.checkResize();  
        var html=''
        var icon = new GIcon(G_DEFAULT_ICON);
        icon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
        icon.iconSize = new GSize(20,20);
        icon.iconAnchor = new GPoint(10,20);
        icon.infoWindowAnchor = new GPoint(10, 20);
        //alert($('#longtitudes').val())
        var longs=$('#longtitudes').val().toString().split(",");        
        //alert(longs.length);
        var lats=$('#lattitudes').val().toString().split(",");        
        for (var i = 0; i < longs.length; i++) {
           // alert(longs[i]);
          var point = new GPoint(parseFloat(longs[i]),parseFloat(lats[i]));
          var marker = new GMarker(point,icon); 
          map.addOverlay(marker);
        }        
        return map;
    }
 
 }

 
 //  uk_map: populate and initialise Google map
function uk_map() {
    var lat=53.173119202640635;
    var lon=-2.0654296875;
    var c_lat=53.10062087921428;
    var c_lon=-9.29443359375;
        
    if ($('#profileMapZoom').length){
        var mapElement="profileMapZoom";
        var zoom_level=16;
    }
    else{
       
        if ($('.profileMapSmall').length){
            var mapElement="profileMapSmall";
            var zoom_level=16;
        }
        else{
    
            var mapElement="profileMap";
            var zoom_level=13;
        }    
    }
    
    if (GBrowserIsCompatible()) {
        var map = new google.maps.Map2(document.getElementById(mapElement));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl())
        map.setCenter(new google.maps.LatLng(parseFloat($('#lattitude').val()), parseFloat($('#longtitude').val())), zoom_level);
        map.checkResize();  
        var html=''
        var icon = new GIcon(G_DEFAULT_ICON);
        icon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
        icon.iconSize = new GSize(20,20);
        icon.iconAnchor = new GPoint(10,20);
        icon.infoWindowAnchor = new GPoint(10, 20);
          var point = new GPoint(parseFloat($('#longtitude').val()),parseFloat($('#lattitude').val()));
          var marker = new GMarker(point,icon); 
          map.addOverlay(marker);
        return map;
    }
 
 }

 //enquiry: display the business card enquiry form
 function enquiry(){
    $('#businessEnquiry').slideDown('slow',function(){
        $('#your_name').focus();
    });
 }

 //validateBusinessCardEnquiry: test the enquiry form before allowing submission
 function validateBusinessCardEnquiry(){
    if (jQuery.trim($('#your_name').val()).length==0){
        show_error_message("please enter your name!",'error_message_panel');
        $('#your_name').focus();
        return false;
    }
    if (jQuery.trim($('#nature').val()).length==0){
        show_error_message("please select the nature of your enquiry!",'error_message_panel');
        $('#nature').focus();
        return false;
    }
    if (jQuery.trim($('#your_email').val()).length==0){
        show_error_message("please enter your email address!",'error_message_panel');
        $('#your_email').focus();
        return false;
    }
//validate email address
    var e=jQuery.trim($('#your_email').val())
	if (!check_email(e,true)){
		show_error_message("The email address you have entered seems to be invalid, please correct your entry !",'error_message_panel');
        $('#your_email').focus();
		return false;
	}
        
    var telephone=fix_telephone(jQuery.trim($('#your_telephone').val()));
    $('#your_telephone').val(telephone);
    
    if (jQuery.trim($('#your_telephone').val()).length==0){
        show_error_message("please enter your telephone number!",'error_message_panel');
        $('#your_telephone').focus();
        return false;
    }
    if (jQuery.trim($('#your_message').val()).length==0){
        show_error_message("please tell us how we can assist!",'error_message_panel');
        $('#your_message').focus();
        return false;
    }
    $('#your_details').val('');
    return true;
 }
 
 
 
  //validateMasterFranchise: test the master franchise enquiry form before allowing submission
 function validateMasterFranchise(){
    //if (jQuery.trim($('#your_company').val()).length==0){
    //    show_error_message("please enter your company name!",'error_message_panel');
    //    $('#your_company').focus();
    //    return false;
   // }
    if (jQuery.trim($('#your_name').val()).length==0){
        show_error_message("please enter your name!",'error_message_panel');
        $('#your_name').focus();
        return false;
    }
    if (jQuery.trim($('#your_email').val()).length==0){
        show_error_message("please enter your email address!",'error_message_panel');
        $('#your_email').focus();
        return false;
    }
//validate email address
    var e=jQuery.trim($('#your_email').val())
	if (!check_email(e,true)){
		show_error_message("The email address you have entered seems to be invalid, please correct your entry !",'error_message_panel');
        $('#your_email').focus();
		return false;
	}
        
    var telephone=fix_telephone(jQuery.trim($('#your_telephone').val()));
    $('#your_telephone').val(telephone);
    
    if (jQuery.trim($('#your_telephone').val()).length==0){
        show_error_message("please enter your telephone number!",'error_message_panel');
        $('#your_telephone').focus();
        return false;
    }
    
    
    if (jQuery.trim($('#your_address1').val()).length==0){
        show_error_message("please enter your street address!",'error_message_panel');
        $('#your_address1').focus();
        return false;
    }
    
    if (jQuery.trim($('#your_address2').val()).length==0){
        show_error_message("please enter your City or Town!",'error_message_panel');
        $('#your_address2').focus();
        return false;
    }
    
    if (jQuery.trim($('#your_address3').val()).length==0){
        show_error_message("please enter your county!",'error_message_panel');
        $('#your_address3').focus();
        return false;
    }
    
//    if (jQuery.trim($('#your_address4').val()).length==0){
//        show_error_message("please enter your post code!",'error_message_panel');
//        $('#your_address4').focus();
//        return false;
//    }
    
    if ($('#your_country').val()==0){
        show_error_message("please select your country!",'error_message_panel');
        $('#your_country').focus();
        return false;
    }
    
    if (jQuery.trim($('#your_investment').val()).length==0){
        show_error_message("please indicate your level of investment!",'error_message_panel');
        $('#your_investment').focus();
        return false;
    }
    
    if (jQuery.trim($('#your_location').val()).length==0){
        show_error_message("please indicate your desired location!",'error_message_panel');
        $('#your_location').focus();
        return false;
    }
    
    if (jQuery.trim($('#your_timeframe').val()).length==0){
        show_error_message("please indicate the timeframe!",'error_message_panel');
        $('#your_timeframe').focus();
        return false;
    }
    
    if (jQuery.trim($('#your_method').val()).length==0){
        show_error_message("please select your preferred method for being contacted!",'error_message_panel');
        $('#your_method').focus();
        return false;
    }
    
    //if (jQuery.trim($('#your_message').val()).length==0){
    //    show_error_message("please tell us how we can assist!",'error_message_panel');
    //    $('#your_message').focus();
    //    return false;
    //}
    $('#your_details').val('');
    return true;
 }
 
 
 
   //validateUnitFranchise: test the unit franchise enquiry form before allowing submission
 function validateUnitFranchise(){
    //if (jQuery.trim($('#your_company').val()).length==0){
    //    show_error_message("please enter your company name!",'error_message_panel');
    //    $('#your_company').focus();
    //    return false;
   // }
    if (jQuery.trim($('#your_name').val()).length==0){
        show_error_message("please enter your name!",'error_message_panel');
        $('#your_name').focus();
        return false;
    }
    if (jQuery.trim($('#your_email').val()).length==0){
        show_error_message("please enter your email address!",'error_message_panel');
        $('#your_email').focus();
        return false;
    }
//validate email address
    var e=jQuery.trim($('#your_email').val())
	if (!check_email(e,true)){
		show_error_message("The email address you have entered seems to be invalid, please correct your entry !",'error_message_panel');
        $('#your_email').focus();
		return false;
	}
        
    var telephone=fix_telephone(jQuery.trim($('#your_telephone').val()));
    $('#your_telephone').val(telephone);
    
    if (jQuery.trim($('#your_telephone').val()).length==0){
        show_error_message("please enter your telephone number!",'error_message_panel');
        $('#your_telephone').focus();
        return false;
    }
    
    
    if (jQuery.trim($('#your_address1').val()).length==0){
        show_error_message("please enter your street address!",'error_message_panel');
        $('#your_address1').focus();
        return false;
    }
    
    if (jQuery.trim($('#your_address2').val()).length==0){
        show_error_message("please enter your City or Town!",'error_message_panel');
        $('#your_address2').focus();
        return false;
    }
    
    if (jQuery.trim($('#your_address3').val()).length==0){
        show_error_message("please enter your county!",'error_message_panel');
        $('#your_address3').focus();
        return false;
    }
    
//    if (jQuery.trim($('#your_address4').val()).length==0){
//        show_error_message("please enter your post code!",'error_message_panel');
//        $('#your_address4').focus();
//        return false;
//    }
    
    if ($('#your_country').val()==0){
        show_error_message("please select your country!",'error_message_panel');
        $('#your_country').focus();
        return false;
    }
    
    if (jQuery.trim($('#your_investment').val()).length==0){
        show_error_message("please indicate your level of investment!",'error_message_panel');
        $('#your_investment').focus();
        return false;
    }
    
    if (jQuery.trim($('#your_location').val()).length==0){
        show_error_message("please indicate your desired location!",'error_message_panel');
        $('#your_location').focus();
        return false;
    }
    
    if (jQuery.trim($('#your_timeframe').val()).length==0){
        show_error_message("please indicate the timeframe!",'error_message_panel');
        $('#your_timeframe').focus();
        return false;
    }
    
    if (jQuery.trim($('#your_method').val()).length==0){
        show_error_message("please select your preferred method for being contacted!",'error_message_panel');
        $('#your_method').focus();
        return false;
    }
    
    //if (jQuery.trim($('#your_message').val()).length==0){
    //    show_error_message("please tell us how we can assist!",'error_message_panel');
    //    $('#your_message').focus();
    //    return false;
    //}
    $('#your_details').val('');
    return true;
 }