var data = {};
var errtxt = {};
data['hull'] = {
//1:{'img':'img/hulliceredbig.png','desc':'Red Coaming (Splash-Rail)','price':5051,'id':92},
//2:{'img':'img/hullicewhitebig.png','desc':'White Coaming (Splash-Rail)','price':5051,'id':100146},
3:{'img':'img/hullicenavybig.png','desc':'Blue Coaming (Splash-Rail)','price':5051,'id':93},
//4:{'img':'img/hulliceorangebig.png','desc':'Orange Coaming (Splash-Rail)','price':5051,'id':100145},
};
data['sail'] = {
// Class Legal
//6:{'img':'img/seabreeze.png','desc':'Vineyard Sail','price':380,'id':937},
//7:{'img':'img/mojito.png','desc':'Mojito Sail','price':380,'id':934},
//8:{'img':'img/colada.png','desc':'Colada Sail','price':380,'id':84},
//9:{'img':'img/maitai.png','desc':'Mai Tai Sail','price':380,'id':936},
//17:{'img':'img/seabreeze2.png','desc':'Sea Breeze Sail','price':380,'pos':2,'id':105958},
//18:{'img':'img/sunrise.png','desc':'Sunrise Sail','price':380,'pos':2,'id':105955},
//19:{'img':'img/orangepop.png','desc':'Orange Pop Sail','price':380,'pos':2,'id':105957},
//20:{'img':'img/bluelagoon.png','desc':'Blue Lagoon','price':380,'pos':2,'id':105954},
//21:{'img':'img/canary.png','desc':'Canary Sail','price':380,'pos':2,'id':105956},
//22:{'img':'img/hurricane.png','desc':'Hurricane Sail','price':380,'pos':2,'id':105953},
4:{'img':'img/racewhite.png','desc':'Race White Sail','price':450,'id':81},
//23:{'img':'img/coral.png','desc':'Coral Cove Sail','price':380,'pos':2,'id':148874},
//24:{'img':'img/voyager.png','desc':'Sunset Voyager Sail','price':380,'pos':2,'id':148873},
//25:{'img':'img/emerald.png','desc':'Emerald Coast Sail','price':380,'pos':2,'id':148875},
26:{'img':'img/hibiscus.png','desc':'Tropical Hibiscus Sail','price':380,'pos':2,'id':148857},
// Recreational
1:{'img':'img/greenwhitenologo.png','desc':'Green-White Sail','price':239,'id':79},
2:{'img':'img/mackinawnologo.png','desc':'Mackinaw Sail','price':239,'id':931},
3:{'img':'img/redwhitenologo.png','desc':'White Sail','price':239,'id':933},
//5:{'img':'img/60thred.png','desc':'60th Anniv. Red Sail','price':250,'id':81},
//10:{'img':'img/newportnologo.png','desc':'Newport Sail','price':249,'id':952},
11:{'img':'img/bluewhitenologo.png','desc':'Blue-White Sail','price':239,'id':957},
12:{'img':'img/redwhitebluenologo.png','desc':'Red-White-Blue Sail','price':239,'id':1191},
13:{'img':'img/racewhitenologo.png','desc':'Race White Sail','price':229,'id':1192},
14:{'img':'img/aquatic.png','desc':'Aquatic Breeze Sail','price':249,'id':105938},
15:{'img':'img/sunsetwin.png','desc':'Malibu Sunset Sail','price':249,'id':105923},
16:{'img':'img/seaside.png','desc':'Seaside Sail','price':239,'id':105937},
};
data['blades'] = {
1:{'desc':'Wood Rudder/Blade','price':325,'price2':275,'id':117,'id2':103,'xtype':'rudder','xtype2':'dboard'},
2:{'desc':'FRP Rudder/Blade','price':435,'price2':525,'id':12,'id2':4,'xtype':'rudder','xtype2':'dboard'},
3:{'desc':'Performance Rudder/Blade','price':450,'price2':350,'id':105982,'id2':105979,'xtype':'rudder','xtype2':'dboard'},
};
data['dolly'] = {
1:{'img':'images/blankspacer.gif','desc':'No Dolly','desc2':'No Dolly','price':0,'id':''},
2:{'img':'images/dolly1542.gif','desc':'Dolly with Standard wheels','desc2':'Dolly with Standard wheels selected','price':560,'id':96},
3:{'img':'images/dolly18952.gif','desc':'Dolly with Wide wheels','desc2':'Dolly with Wide wheels selected','price':760,'id':97},
};
data['cover'] = {
1:{'desc':'No Cover','desc2':'No Cover','price':0,'id':''},
2:{'desc':'Mast Down Deck Cover','desc2':'Mast Down Cover Selected','price':310,'id':99},
3:{'desc':'Mast Up Deck Cover','desc2':'Mast Up Cover Selected','price':365,'id':98},
};
data['hullcover'] = {
1:{'desc':'No Hull Cover','desc2':'No Hull Cover','price':0,'id':''},
2:{'desc':'Sunfish Hull Cover','desc2':'Sunfish Hull Cover Selected','price':275,'id':64327},
};
data['hoist'] = {
1:{'desc':'No Hoister','desc2':'No Hoister','price':0,'id':''},
2:{'desc':'10\' Lift Hoister','desc2':'10\' Lift Hoister Selected','price':198.99,'id':100134},
3:{'desc':'12\' Lift Hoister','desc2':'12\' Lift Hoister Selected','price':209.99,'id':100135},
};
data['ship'] = {
1:{'desc':'In Store Pickup, New Baltimore, MI','note':'Delivery: In Store Pickup'},
2:{'desc':'Delivered to your location','note':'Delivery: Ship'},
};
///// End config, do not edit below /////
var prices = {'total':0,'boat':0,'sail':0,'rudder':0,'dboard':0,'dolly':0,'cover':0,'hullcover':0,'hoist':0};
var items = {'boat':'','sail':'','rudder':'','dboard':'','dolly':'','cover':'','hullcover':'','hoist':''};
var notes = {'boat':'','sail':'','rudder':'','dboard':'','dolly':'','cover':'','hullcover':'','hoist':''};
errtxt['boat'] = 'Please choose a hull stripe color';
errtxt['sail'] = 'Please choose a sail for your boat';
errtxt['blades'] = 'Please choose a rudder and daggerboard for your boat';
calculate_total_price();
preload();
function selectopt(type,val) {
var outprice = 0;
if (typeof data[type][val]['price'] != 'undefined') {
if (typeof data[type][val]['price2'] != 'undefined') {
prices[data[type][val]['xtype2']] = data[type][val]['price2'];
outprice += prices[data[type][val]['xtype2']];
}
if (typeof data[type][val]['xtype'] != 'undefined') {
prices[data[type][val]['xtype']] = data[type][val]['price'];
outprice += prices[data[type][val]['xtype']];
}
else {
prices[type] = data[type][val]['price'];
outprice += prices[type];
}
calculate_total_price();
document.getElementById('totalprice').innerHTML = '$'+currencyformat(prices['total']);
if (outprice > 0) document.getElementById(type+'price').innerHTML = '+$'+currencyformat(outprice);
else document.getElementById(type+'price').innerHTML = '';
}
if (typeof data[type][val]['id'] != 'undefined') {
if (typeof data[type][val]['xtype'] != 'undefined') items[data[type][val]['xtype']] = data[type][val]['id'];
else items[type] = data[type][val]['id'];
}
if (typeof data[type][val]['id2'] != 'undefined') {
if (typeof data[type][val]['xtype2'] != 'undefined') items[data[type][val]['xtype2']] = data[type][val]['id2'];
else items[type] = data[type][val]['id2'];
}
if (typeof data[type][val]['img'] != 'undefined') {
imgid = document.getElementById(type+'img');
imgid.src = "../new_sunfish/"+data[type][val]['img'];
if (type == 'sail') {
if (data[type][val]['pos'] == 2) {
imgid.style.position = 'relative';
imgid.style.left = '2px';
imgid.style.top = '-511px';
//imgid.style.left = '164px';
//imgid.style.top = '468px';
}
else {
imgid.style.position = 'relative';
imgid.style.left = '19px';
imgid.style.top = '-498px';
}
}
}
document.getElementById(type+'txt').innerHTML = data[type][val]['desc'];
if (typeof data[type][val]['desc2'] != 'undefined') document.getElementById(type+'txt2').innerHTML = data[type][val]['desc2'];
if (typeof data[type][val]['note'] != 'undefined') notes[type] = data[type][val]['note'];
//console.log('Ptst: '+JSON.stringify(prices));
//console.log('Itst: '+JSON.stringify(items));
}
function checkform() {
var errs = new Array();
if (items['hull'] == '') { errs[errs.length] = errtxt['boat']; }
else if (items['sail'] == '') { errs[errs.length] = errtxt['sail']; }
else if (items['rudder'] == '' || items['dboard'] == '') { errs[errs.length] = errtxt['blades']; }
var elen = errs.length;
//console.log('E: '+errs);
if (elen > 0) {
var out = document.getElementById('cpopinfo');
for (var i = 0; i