
    var centerWidth = (window.screen.width - 500) / 2;
    var centerHeight = (window.screen.height - 380) / 2;

	function load() {
		 var load = window.open('http://82.146.130.160/chat/chatstart.htm?domain=www.arcsystems.co.uk','chat','width=500,height=380,left=' + centerWidth + ',top=' + centerHeight);
	}

$(document).ready(function() {		
					
					$("#content_header").cycle({
						fx: "scrollLeft",
						timeout: 10000,
					    speed: 1500
					});							
				
					function megaHoverOver(){
												
					    $(this).find(".sub").stop().fadeTo('fast', 1).show(); 
					    (function($) {
					        
					        jQuery.fn.calcSubWidth = function() {
					            rowWidth = 0;
					           
					            $(this).find("ul").each(function() { 
					                rowWidth += $(this).width(); 
					            });
					        };
					    })(jQuery); 
					
					    if ( $(this).find(".row").length > 0 ) { 
					
					        var biggestRow = 0;	
					
					        $(this).find(".row").each(function() {
					            $(this).calcSubWidth(); 
					            
					            if(rowWidth > biggestRow) {
					                biggestRow = rowWidth;
					            }
					        });
					
					        $(this).find(".sub").css({'width' :biggestRow}); 
					        $(this).find(".row:last").css({'margin':'0'});  
					
					    } else { 
					
					        $(this).calcSubWidth();  
					        $(this).find(".sub").css({'width' : rowWidth}); 
					
					    }
					}
					
					function megaHoverOut(){
					  $(this).find(".sub").stop().fadeTo('fast', 0, function() { 
					      $(this).hide(); 
					  });
					}
					
					
					var config = {
					     sensitivity: 2, 
					     interval: 100, 
					     over: megaHoverOver,
					     timeout: 500, 
					     out: megaHoverOut 
					};
					
					$("ul#mainnav li .sub").css({'opacity':'0'}); 
					$("ul#mainnav li").hoverIntent(config); 
					
					$("#tabs").tabs();
					
					$("#promo_sh").click(function () {
						
						$("#news").css('display', 'none'); $("#news_sh").css('font-weight', 'normal'); $("#news_sh").css('color', '#333399');
						$("#whatsnew").css('display', 'none'); $("#new_sh").css('font-weight', 'normal'); $("#new_sh").css('color', '#333399');
						$("#promos").css('display', 'block'); 
						$(this).css('font-weight', 'bold'); $(this).css('color', '#ff9933');
						
					});
					
					$("#news_sh").click(function () {
												
						$("#whatsnew").css('display', 'none'); $("#promo_sh").css('font-weight', 'normal'); $("#promo_sh").css('color', '#333399');
						$("#promos").css('display', 'none'); $("#new_sh").css('font-weight', 'normal'); $("#new_sh").css('color', '#333399');
						$("#news").css('display', 'block');
						$(this).css('font-weight', 'bold'); $(this).css('color', '#ff9933');
						
					});
					
					$("#new_sh").click(function () {
						
						$("#promos").css('display', 'none'); $("#promo_sh").css('font-weight', 'normal'); $("#promo_sh").css('color', '#333399');
						$("#news").css('display', 'none'); $("#news_sh").css('font-weight', 'normal'); $("#news_sh").css('color', '#333399');
						$("#whatsnew").css('display', 'block');
						$(this).css('font-weight', 'bold'); $(this).css('color', '#ff9933');
						
					});
										
					$("#our_partners").cycle({
					    speed:   1000
					});
					
					
					$('#name').show();
					$('#phone').show();
					$('#email').show();
					$('#message').show();
				
				 
					$('.text_field').each(function() {
						var default_value = this.value;
						$(this).focus(function() {
							if(this.value == default_value) {
								this.value = '';
							}
						});
						$(this).blur(function() {
							if(this.value == '') {
								this.value = default_value;
							}
						});
					});
					
					
					$('.multiline').each(function() {
						var default_value = this.value;
						$(this).focus(function() {
							if(this.value == default_value) {
								this.value = '';
							}
						});
						$(this).blur(function() {
							if(this.value == '') {
								this.value = default_value;
							}
						});
					});
					
					$("#testimonials").cycle({
						delay: 10000,
						timeout: 10000,
					    speed: 1500
					});	
					
					$("#login").click(function() {
						
						$("#log_msg").html("Login Failed - Username/Password Incorrect.")
						
					});	
					
					
					$("#quick_quote_frm").validate({
						rules: {
							name: "required",
							phone: "required",
							email: {
								required: true,
								email: true
							},
							message: "required"
						},
						messages: {
							name: "Please enter your name",
							phone: "Please provide your phone number",
							email: "Please enter a valid email address",
							message: "Please provide a message"
						}
					});
					
					
					$("#quick_quote").click(function() {
						
						if ($("#quick_quote_frm").valid()) {
						
							$("#qq-send").html("<img src=\"http://cpanel01.chunkychips.net/~arc/images/loading.gif\" alt=\"Loading...\" style=\"float: left;\" /> <span style=\"float: left; margin-left: 10px;\">Sending...</span>");
							
							var formdata = $("#quick_quote_frm").serialize();
							
							$.ajax({
								type: "POST",
								url: "http://cpanel01.chunkychips.net/~arc/submailer.php?page=quick_quote",
								data: formdata,
								success: function(msg){
									$("#qq-send").html("<span style=\"float: left; margin-left: 10px;\">" + msg + "</span>");
									$("#name").val("Name");
									$("#phone").val("Telephone Number");
									$("#email").val("Email");
									$("#message").val("Message");								}
							});
							
						}
						
					});	
					
					
					$("#contact_form").validate({
						rules: {
							name: "required",
							company: "required",
							postcode: "required",
							phone: "required",
							email: {
								required: true,
								email: true
							},
							enquiry: "required"
						},
						messages: {
							name: "Please enter your name",
							company: "Please enter your company name",
							postcode: "Please enter your postcode",
							phone: "Please provide your phone number",
							email: "Please enter a valid email address",
							enquiry: "Please provide a message"
						}
					});
					
					
					$("#send_contact").click(function() {
						
						if ($("#contact_form").valid()) {
						
							$("#cf-send").html("<img src=\"http://cpanel01.chunkychips.net/~arc/images/loading.gif\" alt=\"Loading...\" style=\"float: left; margin: 5px 0 0 5px;\" /> <span style=\"float: left; margin: 5px 0 0 10px; font-size: 14px;\">Sending...</span>");
							
							var formdata = $("#contact_form").serialize();
							
							$.ajax({
								type: "POST",
								url: "http://cpanel01.chunkychips.net/~arc/submailer.php?page=contact_form",
								data: formdata,
								success: function(msg){
									$("#cf-send").html(msg);
								}
							});
							
						}
						
					});								
					
												
			});