// INITIALIZE POPUP WINDOW
function InitializeDialog() {
// Dialog
$('#Drag_Container').dialog({
autoOpen: false,
width: 850,
height: 700,
buttons: {
"Cancel": function() { AJX_CloseWindow(0); }
},
"close": function() { AJX_CloseWindow(0, 1); }
});
}
function ListingPopUp(LID, LType) {
// 1 = Map
// 2 = Email
// 3 = WWW
// 4 = Featured Page
AJX_CloseWindow(0);
var H = $(window).height();
H = H * .9;
var W = $(window).width();
if (W <= 1024) {
W = $(window).width()-25;
} else {
W = W * .6;
}
var WindowURL= '';
if (LType == 1) {
// Map Link
var PopUpTitle = "View Map to Business";
W=550;
H=650;
WindowURL = "/show_map.html?ListingID=" + LID;
$('#Drag_Container').dialog('option', 'buttons', {
"Close": function() {
AJX_CloseWindow(0);
}
});
}
if (LType == 2) {
// Email Link
var PopUpTitle = "Send Business an Inquiry";
W=500;
H=600;
WindowURL = "/show_email.html?ListingID=" + LID;
$('#Drag_Container').dialog('option', 'buttons', {
"Close": function() {
AJX_CloseWindow(0);
},
"Send Email": function() {
AJX_SaveRecord();
Record_ID='';
}
});
}
if (LType == 3) {
// Website Link
// THIS NO LONGER SHOWS AS A POPUP
PWidth=0;
PHeight=0;
// WindowURL = "/show_www.html?ListingID=" + LID;
}
if (LType == 4) {
// Featured Page Link
// THIS NO LONGER SHOWS AS A POPUP
PWidth=0;
PHeight=0;
//WindowURL = "/show_fp.html?ListingID=" + LID;
}
if (LType == 5) {
// Send Listing To Friend
var PopUpTitle = "Send Listing To Friend";
W=550;
H=550;
WindowURL = "/show_send_friend.html?ListingID=" + LID;
$('#Drag_Container').dialog('option', 'buttons', {
"Close": function() {
AJX_CloseWindow(0);
},
"Send Email": function() {
AJX_SaveRecord();
Record_ID='';
}
});
}
if (LType == 6) {
// Add Listing To Trip
var PopUpTitle = "Add Listing To Trip";
W=300;
H=300;
WindowURL = "/show_add_to_trip.html?ListingID=" + LID;
$('#Drag_Container').dialog('option', 'buttons', {
"Close": function() {
AJX_CloseWindow(0);
}
});
}
if (LType == 7) {
// Send Listing To Friend
var PopUpTitle = "Video";
W=650;
H=560;
WindowURL = "/show_listing_video.html?ListingID=" + LID;
$('#Drag_Container').dialog('option', 'buttons', {
"Close": function() {
AJX_CloseWindow(0);
}
});
}
if (WindowURL != '') {
var HTMLCode='';
var ty_ie=0;
DialogHTML = '';
// ###################################################
// JQUERY POPUP
$('#Drag_Container').dialog('option', 'height', H);
$('#Drag_Container').dialog('option', 'width', W);
$("#Drag_Container").dialog('open');
$('#Drag_Container').dialog('option', 'title', PopUpTitle);
WriteInnerHTML("Drag_Container", DialogHTML);
dialogstaticbar(W, H);
// ###################################################
}
}
/*
###########################################
SEND FUNCTION
###########################################
*/
function AJX_SaveRecord() {
if (BrowserDetect.browser == "Firefox" || BrowserDetect.browser == "Chrome") {
document.getElementById("Edit_Form").contentWindow.submitForm();
} else if (BrowserDetect.browser == "Explorer") {
window.frames["Edit_Form"].submitForm();
} else {
alert("There was an error with the browser you are using. Please use firefox!\n\n" + BrowserDetect.browser + " -- " + BrowserDetect.version + " -- " + BrowserDetect.OS);
}
}
/*
###########################################
CLOSE WINDOW
###########################################
*/
function AJX_CloseWindow(closetype, closebutton) {
WriteInnerHTML("Drag_Container", DialogHTML);
if (closebutton != 1) $('#Drag_Container').dialog("close");
}
// ############################################
// Save Record
// ############################################
function ListingSubmitForm() {
if (BrowserDetect.browser == "Firefox" || BrowserDetect.browser == "Chrome") {
document.getElementById("Edit_Form").contentWindow.submitForm();
} else if (BrowserDetect.browser == "Explorer") {
window.frames["Edit_Form"].submitForm();
} else {
alert("There was an error with the browser you are using. Please use firefox!\n\n" + BrowserDetect.browser + " -- " + BrowserDetect.version + " -- " + BrowserDetect.OS);
}
}
function WriteInnerHTML(p_DivID,p_htmlstr) {
if (document.getElementById) {
document.getElementById(p_DivID).innerHTML= p_htmlstr;
} else {
with (document.layers[p_DivID].document) {
open();
write(p_htmlstr);
close();
}
}
}
function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function dialogstaticbar(DivWidth, DivHeight) {
NewDivName = "Edit_Form";
var H = $(window).height();
var W = $(window).width();
// CHANGE WIDTH
W = W / 2;
W = Math.round(W - (DivWidth/2));
H = H / 2;
H = Math.round(H - (DivHeight/2));
function ml2(id){
var el2=document.getElementById(id);
if (document.layers) el2.style=el2;
el2.x = W+"px";
el2.y = H+"px";
return el2;
}
if (showbar2 != 1) {
showbar2=1;
FloatObject = ml2(NewDivName);
//stayTopLeft2();
}
}
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i