// Vendor js - cc.vendor.js - beaver6813 - sam cleaver
google.load("maps", "2.x",{
"other_params":"key=AIzaSyDzhEWO1-7xEOsWa5V8X5wbtM-8R6vFw7w"
});
var map = null;
var geocoder = null;
var bounds = null;
var baseIcon = null;
// Call this function when the page has been loaded
function initialize() {
map = new google.maps.Map2(document.getElementById("map"));
map.setCenter(new google.maps.LatLng(0, 0), 0);
map.setUIToDefault();
geocoder = new google.maps.ClientGeocoder();
bounds = new google.maps.LatLngBounds();
baseIcon = new google.maps.Icon(G_DEFAULT_ICON);
baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
baseIcon.iconSize = new google.maps.Size(20, 34);
baseIcon.shadowSize = new google.maps.Size(37, 34);
baseIcon.iconAnchor = new google.maps.Point(9, 34);
baseIcon.infoWindowAnchor = new google.maps.Point(9, 2);
$(".mapresult").bind("click", function(){
centermap(this);
});
if (geocoder) {
$(".mapresult").each(function (i) {
var line1 = $(this).children('div').children('.locationtitle').text();
var line2 = $(this).children('div').children('.locationaddress').text();
var address = line1+' '+line2;
var iconimage = $(this).children('img').attr('src');
geocoder.getLatLng(
address,
function(point) {
bounds.extend(point);
var letteredIcon = new google.maps.Icon(baseIcon);
letteredIcon.image = iconimage;
// Set up our GMarkerOptions object
markerOptions = {
icon:letteredIcon
};
var marker = new google.maps.Marker(point,markerOptions);
map.addOverlay(marker);
//marker.openInfoWindowHtml(address);
});
setTimeout(function() {
map.checkResize();
map.setCenter(bounds.getCenter());
if($(".mapresult").length==1)
map.setZoom(17);
else
map.setZoom(map.getBoundsZoomLevel(bounds));
},1000);
});
}
$('#tabs').bind('tabsshow', function(event, ui) {
if (ui.panel.id == "locations") {
setTimeout(function() {
map.checkResize();
map.setCenter(bounds.getCenter());
if($(".mapresult").length==1)
map.setZoom(17);
else
map.setZoom(map.getBoundsZoomLevel(bounds));
} ,1000);
}
});
}
function centermap(e)
{
var line1 = $(e).children('div').children('.locationtitle').text();
var line2 = $(e).children('div').children('.locationaddress').text();
var address = line1+' '+line2;
var iconimage = $(e).children('img').attr('src');
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.panTo(point);
}
});
}
google.setOnLoadCallback(initialize);
$(function() {
$('.rating').live('click',function() {
var couponid = $(this).parent().parent().siblings('.couponiddata').val();
var resp = $(this).attr('rel');
var target = $(this);
$.ajax({
type: "GET",
url: "/setresponse.php",
data: "type=Ratings&ID="+couponid+"&Resp="+resp,
success: function(msg){
if(msg=='TRUE')
{
target.children('span').text(parseInt(target.children('span').text())+1);
}
else if(msg=='NOLOGIN')
alert("You must be logged in to rate coupons.");
else
alert("You have already rated this item.");
}
});
});
$("#accordion").accordion({
autoHeight: false,
collapsible: true,
active: false
});
$("#tabs").tabs();
$('.coupontitle').live('click', function(){
couponswitch($(this).parent().parent());
});
$('.coupondesc').live('click', function(){
couponswitch($(this).parent().parent());
});
$('.couponimage').live('click', function(){
couponswitch($(this).parent().parent());
});
$('.mediatitle').live('click', function(){
mediaswitch($(this).parent().parent());
});
$('.mediadesc').live('click', function(){
mediaswitch($(this).parent().parent());
});
$('.mediaimage').live('click', function(){
mediaswitch($(this).parent());
});
$(".vendorcalender").datepicker();
$('.rating').live('mouseover',function() {
$(this).addClass('ui-state-active').addClass('ui-state-selected');
});
$('.rating').live('mouseout',function() {
$(this).removeClass('ui-state-active').removeClass('ui-state-selected');
});
});
function couponswitch(e)
{
$('.couponfull h5').html(e.children('.couponcolumn').children('.coupontitle').text());
if(e.children('.offerbuynow').val()=='')
$('.couponfimage').attr('src',e.children('.couponimagedata').val());
else
$('.couponfimage').attr('src','/images/giftcertficate.png');
$('.couponfimage').siblings('.couponiddata').val(e.children('.couponiddata').val());
if(e.children('.offerbuynow').val()=='')
$('.couponfdesc').html(e.children('.coupondescdata').val());
else
$('.couponfdesc').html(e.children('.coupondescdata').val()+'
');
var buildlegend = '';
if(e.children('.couponquotedata').val()==1)
buildlegend = buildlegend + ' Mention.';
if(e.children('.couponsmsdata').val()==1)
buildlegend = buildlegend + ' Send to Mobile.';
if(e.children('.couponprintdata').val()==1)
buildlegend = buildlegend + ' Print.';
buildlegend = buildlegend + '