var active = '';
var circle_data = {};
circle_data.specials = "<div class='headline'>Specials & Promotions</div>For those times when your insurance company isn’t involved in your repairs, Sterling is always offering up various discounts on the services we provide.";
circle_data.care = "<div class='headline'>Complete Customer Care</div>From getting an estimate to knowing the status of your car to our customer satisfaction initiative, Sterling wants to provide every opportunity to make sure you’re completely satisfied every step of the way.";
circle_data.place = "<div class='headline'>Clean Facilities</div>Walk into our stores and you’ll see right away what we mean when we say “customer first”. From the moment you step into our lobby, we want you to walk away knowing that you and your vehicle are in good hands.";
circle_data.green = "<div class='headline'>Green Initiative</div>We are on the cutting edge of implementing products and procedures that protect our environment, which is why we have rolled out our environmentally safe water-based paints across each of our locations.";
circle_data.lean = "<div class='headline'>Lean Initiative</div>We’re consistently developing better, more efficient ways to get your vehicle back faster, better, cheaper. That’s what being lean is all about. And we’re leading the discussion.";
circle_data.status = "<div class='headline'>Vehicle Status Updates</div>When you leave your vehicle with us, we keep you updated with what stage of the process your car is in so you never have to wonder.";
circle_data.resource = "<div class='headline'>Resource Center</div>From industry professionals to those who have experienced what you’re going through, we’ve developed a place for you to get the answers and support you need after an accident and to help you be prepared in case of an emergency.";
circle_data.faq = "<div class='headline'>FAQ</div>Get answers to your questions and find questions you may have never thought to ask. ";
circle_data.partners = "<div class='headline'>Strategic Partners</div>Our partnerships help you save. Enterprise is our first example. Whether you’ve been in an accident or just need a car for the weekend, we can help.";
circle_data.employment = "<div class='headline'>Employment Opportunities</div>Sterling has many great opportunities and benefits. Our biggest benefits are the tools and skills you acquire after being a part of our team.";
circle_data.experiences = "<div class='headline'>Shared Experiences</div>Learn from others that have gone before you and get support – or help us grow this community and support your fellow drivers by submitting your stories of how you worked your way past the difficult times after an accident.";
circle_data.community = "<div class='headline'>Community</div>Find out how Sterling is giving back and sharing our resources and skills to those in need.";
circle_data.prepared = "<div class='headline'>Emergency Care Kit</div>Be prepared. We’ve assembled a collection of tools and resources for you to take on the road with – just in case you need them.";
circle_data.promise = "<div class='headline'>Lifetime Limited Warranty</div>If you are not satisfied with the workmanship, paint finish or anything else, we’ll take care of it willingly and without charge for as long as you own your car. Find out more.";
circle_data.clean = "<div class='headline'>Clean Facilities</div>Walk into our stores and you’ll see right away what we mean when we say 'customer first'. From the moment you step into our lobby, we want you to walk away knowing that you and your vehicle are in good hands.";
circle_data.custcent = "<div class='headline'>Customer Centric Leadership</div>Our leadership team focuses on the customer first. You are the focal point of every decision we make. Hear what our leaders have to say.";
circle_data.sterling = "<div class='headline'>Sterling Advantage</div>Process, People, Performance, Place, Promise: these are the core elements of what make Sterling the leader in collision repair.";
circle_data.performance = "<div class='headline'>Strategic Partners</div>Our partnerships help you save. Enterprise is our first example. Whether you’ve been in an accident or just need a car for the weekend, we can help.";
circle_data.work = "<div class='headline'>PIT Stops</div>Come into our shop anytime to have your fluids topped off at no cost.";

circle_urls = {};
circle_urls.specials = "/specials_promos";
circle_urls.care =  "/customer_care";
circle_urls.place =  "/place";
circle_urls.employment = 'https://www8.ultirecruit.com/STE1014/JobBoard/ListJobs.aspx?__VT=ExtCan';
circle_urls.green =  "/place";
circle_urls.lean =  "/place";
circle_urls.status =  "/vehicle_status";
circle_urls.resource = "/resource_center";
circle_urls.faq = "/faq";
circle_urls.partners =  "/partners";
circle_urls.experiences =  "/blog/?cat=4";
circle_urls.community =  "/community";
circle_urls.prepared =  "/be_prepared";
circle_urls.promise =  "/promise";
circle_urls.clean =  "/place";
circle_urls.custcent = '/leadership';
circle_urls.sterling = '/sterling_advantage';
circle_urls.performance = '/services';
circle_urls.work = '/be_prepared';

/*
var process_data = {};
process_data.accident = {image:"images/process_in_an_accident.jpg", headline:"Been in an Accident", body:"For most of our customers, they never really learn much about us until after they’ve been involved in an accident. If that’s the case for you, rest assured that we’ve got your back. Check out our site and you’ll find all sorts of tools and features to help you with any research and questions you might have. Talk to any of our employees and they’ll help you get on the right track. Or, talk to any one of our customers and they’ll share with you how we helped them get back on the road."};
process_data.people = {image:"images/process_customer_rep.jpg", headline:"Customer Service Representative", body:"As soon as you enter the store, you are greeted and introduced to your Customer Service Representative, who will be your single point of contact throughout the repair process. This person will help you complete the necessary information. You will be invited to tour the facility and see the unique Sterling repair process for repairing your car."};
process_data.analysis = {image:"images/process_damage_asses.jpg", headline:"Initial Damage Analysis", body:"We want your business and we will provide you with a comprehensive Repair Plan. In your presence, we will complete the Sterling Initial Damage Assessment. During this physical inspection of your automobile, the trained technician closely examines all aspects of the car that might have suffered any damage. Within a few moments, you are provided with a copy of an initial estimate for approval to proceed with the work."};
process_data.assesment = {image:"images/process_disassemble.jpg", headline:"Disassemble", body:"Once the estimate is approved, we will disassemble the damaged area of your car so that a more complete analysis can be determined. We will then provide you a final estimate that accounts for any amendments in the Initial Damage Assessment."};
process_data.work = {image:"images/process_completion.jpg", headline:"Work Completion", body:"With state-of-the-art equipment, technology and streamline systems, we’ll complete the work on your vehicle with great expertise and efficiency so you can get back on the road as soon as possible. We contact you throughout the repair process to keep you informed on the status of your vehicle."};
process_data.inspection = {image:"images/process_inspection.jpg", headline:"Customer Inspection", body:"We want you completely satisfied every time. Once you come to pick up your vehicle, we’ll review all the work with you in detail and inspect everything together."};
process_data.delivery = {image:"images/process_delivery.jpg", headline:"Delivery", body:"At the time of delivery, your car will be thoroughly cleaned and washed. Once you've driven off the lot, our job is still not complete. We will follow up with you to make sure you're satisfied with the repairs."};
*/



/*
var status_data = {};
status_data.customer = {image:"images/status_dropoff.jpg", headline:"Customer Care Drop Off", body:"<p>Thank you for choosing Sterling Autobody Centers. You made the right choice in auto repair!</p><p>At this point of the repair, we review the information received by your insurance company and look over the damaged area of your vehicle with you.</p><p>After reviewing the damages with you, our Customer Service Representative will go over what to expect throughout the repair and get any signed documentation needed at this point.</p>"};

status_data.assesment = {image:"images/status_analysis.jpg", headline:"Damage Analysis", body:"<p>Sterling Autobody Centers’ unique Damage Analysis allows us to remove as many unknown variables from the repair process as possible. By completely disassembling the damaged area of your vehicle, we can document the most accurate and thorough repair plan possible.</p><p>Indentifying all the damages up front allows us to order all of the parts necessary to complete the repairs, reduce or eliminate supplements and minimize the repair time for your vehicle.</p>"};

status_data.process = {image:"images/status_prod_ready.jpg", headline:"Ready for Production", body:"<p>A lot of work has already taken place to get your vehicle to this stage.</p><p>100% of the parts have been received.</p><p>All heavy structural repairs have been completed.</p>"};

status_data.work = {image:"images/status_in_prog.jpg", headline:"Repair in Progress", body:"<p>Repair in progress simply means your vehicle is being put back together and beginning to take form. Your vehicle will soon have any light body repairs completed and we’ll ensure all body panels align properly.</p>"};

status_data.paint = {image:"images/status_paint.jpg", headline:"Paint", body:"<p>Paint preparation is an integral part to the longevity of the paint applied. Sterling uses industry leading paint and practices to get your vehicle looking back to pre accident condition.</p>"};

status_data.delivery = {image:"images/status_pickup.jpg", headline:"Ready for Pickup", body:"<p>Your vehicle has gone through multiple in-line quality checks to ensure the repairs were done properly and most importantly, to ensure your safety.</p><p>Your vehicle has also been thoroughly cleaned inside and out, with a wheel shine, vacuumed inside and washed outside.</p><p>Your vehicle is ready to go home with you.</p>"};

status_data.performance = {image:"images/status_gaurantee.jpg", headline:"Ensuring Your Complete Satisfaction", body:"<p><span style='font-weight: bold;'>If you’re not satisfied, we’re not satisfied!</span></p><p> If at any time, during your repair, you are not satisfied with our service or the quality of work you have received, please let us know what we can do to ensure your complete satisfaction!</p><p>We also take that final step to call you personally and ask for your feedback. </p><p>Ask us about our 10’s and Yes’s Policy.</p>"};
*/


function goAnswerPage(){
	if(active != '')
	{
		if(circle_urls[active] != ''){ window.location= circle_urls[active];}
	}else{
		if(circle_urls[active] != ''){ window.location= 'sterling_advantage';}
	}
}

function rollOver(name, i){
	if(name != active)
	{
	 	document[name].src = 'images/icons/73/' + name + '_on.png';
	}
}

function rollOut(name, i){
	if(name != active)
	{
 		document[name].src = 'images/icons/73/' + name + '_act.png';		
	}
}

function story_rollOver(name, i){
	if(name != story_active)
	{
	 	document[name].src = 'images/' + name + '_act.png';
	}
}

function story_rollOut(name, i){
	if(name != story_active)
	{
 		document[name].src = 'images/' + name + '_on.png';		
	}
}

var story_active = 'story_icon_1';


function storyClick(name, icon, i){
	if(icon != story_active)
	{
		if(story_active != '')
		{
	 		document[story_active].src = 'images/' + story_active + '_on.png';		
		}
		document.getElementById('story_content_contatianer').innerHTML = document.getElementById('story_content_' + i).innerHTML;
		//document.getElementById('the_story').innerHTML = story_data[name].story;
		//document.getElementById('the_testimonial').innerHTML = story_data[name].testimonial;
		//document.getElementById('story_image').src = story_data[name].image;
		//document[name].src = 'images/icons/73/' + name + '_on.png';		
		story_active = icon;
	}
}

function processAnswerClick(name, i){

	if(active != '')
	{
 		document[active].src = 'images/icons/73/' + active + '_act.png';		
	}
	document.getElementById('process_browser_detail_window').innerHTML = document.getElementById(name + '_data').innerHTML;
	//document.getElementById('process_browser_detail_window_headline').innerHTML = process_data[name].headline;
	//document.getElementById('process_browser_detail_window_body').innerHTML = process_data[name].body;
	//document.getElementById('process_browser_detail_window_image').src = process_data[name].image;
	document[name].src = 'images/icons/73/' + name + '_on.png';		
	active = name;
}


function showAnswerClick(name, i){
	//alert(name);
	if(active != '')
	{
 		document[active].src = 'images/icons/73/' + active + '_act.png';		
	}
	//document.getElementById('icon_circle_middle_content').innerHTML = circle_data[name];
	document.getElementById('icon_circle_middle_content').innerHTML = document.getElementById(name + '_content').innerHTML
	document.getElementById('icon_circle_middle_img').style.backgroundImage = "url(images/mission_center_" + name + ".png)";
	document[name].src = 'images/icons/73/' + name + '_on.png';		
	active = name;
	
//	alert(document.getElementById('icon_circle_middle_img').style.backgroundImage);
}

function statusAnswerClick(name, i){
	if(active != '')
	{
 		document[active].src = 'images/icons/73/' + active + '_act.png';		
	}
//	log(document.getElementById(name + '_data'));
	document.getElementById('vehicle_status_detail_window').innerHTML = document.getElementById(name + '_data').innerHTML
	//document.getElementById('vehicle_status_detail_window_headline').innerHTML = status_data[name].headline;
	//document.getElementById('vehicle_status_detail_window_body').innerHTML = status_data[name].body;
	//document.getElementById('vehicle_status_detail_window_image').src = status_data[name].image;	
	document[name].src = 'images/icons/73/' + name + '_on.png';
	active = name;
}

/* 	LEADERSHIP */

var active_leader = 'nick';

var leader_data = {};
leader_data.nick = 
	{image:"nick_notte.jpg",
	name:"Nick Notte",
	title:"President",
	fun_title:"Chief Making it Happen Officer",
	quote:"“Don’t tell me it can’t be done, because I know it can.”",
	statement:"Nick oversees Sterling’s nationwide network of collision repair centers, ensuring that our process, people, performance and place are working in synch to make the process as easy as possible for each and every customer.",
	video:"",
	link:"#nick_notte"};

leader_data.tony = 
	{image:"tony_gianollae.jpg",
	name:"Tony Gianollae",
	title:"Vice President",
	fun_title:"Chief Making it Happenish Officer",
	quote:"“Don’t tell me it can’t be done, ever.”",
	statement:"Tony oversees Sterling’s nationwide network of collision repair centers, ensuring that our process, people, performance and place are working in synch to make the process as easy as possible for each and every customer.",
	video:"",
	link:"#tony_gianollae"};


leader_data.blank = 
	{image:"",
	name:"",
	title:"",
	fun_title:"",
	quote:"",
	statement:"",
	video:"",
	link:""};

function leaderRollOver(ob){
	var name = ob.name;
	if(name != active_leader)
	{
		document.getElementById(name + '_icon').src = "images/leader_icons_" +  name + "_on.jpg";
	}
}
/*
9 Tech Circle
Natick, MA 01760
Phone: (800) 653-5310 ext. 0
Fax: (508) 653-9538
Email: generalinfo@sterling-usa.com
*/

function leaderRollOut(ob){
	var name = ob.name;
	if(name != active_leader)
	{
		document.getElementById(name + '_icon').src = "images/leader_icons_" +  name + "_off.jpg";
	}
}

function leaderBioClick(){
	var str = "/bios#" + active_leader;
	window.location= str;
}

function leaderClick(ob){
	var name = ob.name;
	document.getElementById(active_leader + '_icon').src = "images/leader_icons_" +  active_leader + "_off.jpg";
	document.getElementById('leader_content').innerHTML = document.getElementById(name + '_content').innerHTML;
	//alert(document.getElementById(name + '_content').innerHTML);
	active_leader = name;
}

/* LOCATOR STUFF */

var active_locator_obj = {}

function update_locator_display(ob){
	//log('update_locator_display');
	//log(ob);
	show('driving_directions');
	show('hours_label');
	document.getElementById('store_address_1').innerHTML = ob.address;
	document.getElementById('store_address_2').innerHTML = "";
	document.getElementById('store_email').innerHTML = ob.email;
	document.getElementById('store_fax').innerHTML = ob.fax;
	document.getElementById('store_phone').innerHTML = ob.phone;
	document.getElementById('store_hours_1').innerHTML = ob.hours[0];
	document.getElementById('store_hours_2').innerHTML = ob.hours[1];
	active_locator_obj = ob;
}

function driving_directions(){
	if(active_locator_obj.link != undefined)
	{
		window.location = active_locator_obj.link
	}
}

function select_store_location(ob){

	log(sel_object);
	//log(sel_object['fudge']);
	//log(sel_object[ob.name]);
	ar = sel_object[ob.name];
	log(ar[3]);

	if(ar != undefined)
	{
		cm_map.setCenter(new GLatLng(ar[0],ar[1]), 11);		
	}

	update_locator_display(ar[3]);
	close_map_selector()
}

function close_map_selector(){
	hide('map_selector');
	show('map_container');
}

function open_map_selector(){
	show('map_selector');
	hide('map_container');
}

function validate(ar,email){
	tf = true
	for(i = 0; i < ar.length; i++)
	{
		//alert(document.getElementById(ar[i]).value);
		//alert(document.getElementById(ar[i]).style.borderColor);
		if(document.getElementById(ar[i]).value == ''){
			 tf=false;
			document.getElementById(ar[i]).style.borderColor = "#cc0000" ;
		}else{
			document.getElementById(ar[i]).style.borderColor = "#eeeeee" ;
		}
	}
	if(!tf){ 
		show('complete_form_message');
		return false;
	}
	
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   	var address = document.getElementById(email).value;

   	if(reg.test(address) == false){
		tf = false;
		document.getElementById(email).style.borderColor = "#cc0000" ;
	}

	if(tf){
		//tb_show("Thank You", 'thanks_iframe?keepThis=true&TB_iframe=true&height=410&width=630',false);
	}else{
		show('complete_form_message');
		return false;
	}
}

function check_estmate_form(ar){
	tf = true
	for(i = 0; i < ar.length; i++)
	{
		//alert(document.getElementById(ar[i]).value);
		//alert(document.getElementById(ar[i]).style.borderColor);
		if(document.getElementById(ar[i]).value == ''){
			 tf=false;
			document.getElementById(ar[i]).style.borderColor = "#cc0000" ;
		}else{
			document.getElementById(ar[i]).style.borderColor = "#eeeeee" ;
		}
	}
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   	var address = document.getElementById('email_input').value;
   	if(reg.test(address) == false){
		tf = false;
		document.getElementById('email_input').style.borderColor = "#cc0000" ;
	}
   
	if(tf){
		//tb_show("Thank You", 'thanks_iframe?keepThis=true&TB_iframe=true&height=410&width=630',false);
		window.location = "/submit_thank_you"
	}else{
		show('complete_form_message');
	}
}

function log(message){
	if(typeof console == "object"){
		console.log(message);
	}
}

