function check_login(f_url)
{
var user, passw, url, config, cred, cback;
//console.log("Passed URL "+f_url);
//get data from form, setup for AJAX
user = document.getElementById('uname').value;
passw = document.getElementById('pass').value;
cred = {"username":user,"password":passw};
url = SITEconfig.protocol + SITEconfig.sites.www +"/ajax_login.php";
// we're having a bug where some redirect URI's are bogus
//f_url = f_url.replace("https://", "https:||");
//f_url = f_url.replace("/", "_");
f_url = f_url.replace("%2F", "_");
//f_url = f_url.replace("https:||", "https://");
// AJAX callback, called on "successful" AJAX return
cback = function(d){
dd = JSON.parse(d);
if (dd.auth == 'true') {
//console.log("docCookie: setting session to "+dd.session);
//docCookies.setItem("user_session", dd.session, '', "/", "."+SITEconfig.cookiedomain);
modal_login_close_new();
if (f_url == 'self') {
window.location.reload();
} else {
window.location.href = f_url;
}
return false;
} else {
jQuery("#modal_login").effect("shake");
return false;
}
};
// AJAX configuration
config = {"method":"POST","data":cred,"success":cback};
if (typeof($) !== 'undefined' && typeof($.ajax) === "function") {
$.ajax(url, config);
} else if (typeof($jqs) !== "undefined" && typeof($jqs.ajax) === "function") {
$jqs.ajax(url, config);
} else if (typeof(jQuery) !== "undefined" && typeof(jQuery.ajax) === "function") {
jQuery.ajax(url, config);
}
return;
} //EOF
function login_div(type,adno,location)
{
var div,newdiv,newdivtxt,leftmar,f_url,closer,blackbg;
div = document.getElementById('kk_blk_overlay');
div.style.display = "block";
leftmar = "style='margin-left:3px;'";
if (window.location.href.indexOf("/listing")) {
leftmar = '';
}
//KDK testing
f_url = "self";
blackbg= document.getElementById('kk_blk_overlay');
if (location == 5 || location == 2) {
closer = ""
+"
";
} else if (location == 6) {
closer = ""
+"
";
} else {
closer = ""
+"
";
}
newdiv = document.createElement("div");
newdivtxt = "
Log In to Continue "+closer+"
";
//onclick="check_login('+"'"+f_url+"'"+');return false;"'+"
newdiv.innerHTML=newdivtxt;
if (location < 1) { location = 1; }
if (location==5 || location==2) { //listing rightbar lower
div = document.getElementById('tri_contact');
}
if (location == 6) {
div = document.getElementById("order_wrapper");
}
blackbg.style.display = "block";
blackbg.style.zIndex = "11";
newdiv.setAttribute("id", "modal_login");
if (document.body.contains(document.getElementById('neworder_div'))) {
document.getElementById('neworder_div').style.zIndex=10;
}
div.appendChild(newdiv);
}
function modal_login_close() {
'use strict';
var ele, blackbg;
ele = document.getElementById("kk_blk_overlay")
ele.removeChild(ele.lastChild);
if (typeof(window.hold_black_background) == 'number' && window.hold_black_background > 0) {
if (document.body.contains(document.getElementById('neworder_div'))) {
//console.log('found div and setting zIndex');
document.getElementById('neworder_div').style.zIndex=1112;
} else {
//console.log("could not find neworder_div");
}
return;
}
blackbg = document.getElementById('kk_blk_overlay');
blackbg.style.display="none";
}
function modal_login_close_order() {
'use strict';
var ele, blackbg;
ele = document.getElementById("order_wrapper");
ele.removeChild(ele.lastChild);
blackbg = document.getElementById('kk_blk_overlay');
blackbg.style.display="none";
}
function modal_login_close_side() {
'use strict';
var ele, blackbg;
ele = document.getElementById("tri_contact");
ele.removeChild(ele.lastChild);
blackbg = document.getElementById('kk_blk_overlay');
blackbg.style.display="none";
}
function modal_login_close_head(store_flag) {
var div,blackbg;
if (store_flag == 'stores') {
div = document.getElementById("seller_type_2");
} else if (store_flag == "stores_main") {
div = document.getElementById("seller_type");
} else {
div = document.getElementById("homelink");
}
div.removeChild(div.lastChild);
blackbg = document.getElementById('kk_blk_overlay');
blackbg.style.display="none";
}
function login_div_head(store_flag) {
'use strict';
var div, closer, f_url, newdiv, image, newdivtxt, pages, blackbg, ndiv_h, store_flag_str;
if (store_flag == 'stores') {
div = document.getElementById("seller_type_2");
} else if (store_flag == "stores_main") {
div = document.getElementById("seller_type");
} else {
div = document.getElementById("homelink");
var store_flag = "na";
}
store_flag_str = '\x22'+store_flag+'\x22';
closer = ""
+"
";
pages = ['/financing_leasing','/manufacturers','/distributors','/wholesalers','/parts_supplies','/service_repair',
'/software_companies','/transportation_logistics','/service_directory'];
ndiv_h = "260px";
if (pages.indexOf(window.location.pathname) > -1) {
closer = "
";
ndiv_h = "265px";
}
f_url = "self";
newdiv = document.createElement("div");
blackbg = document.getElementById('kk_blk_overlay');
//image = "
";
newdivtxt = " Log In to Continue "+closer+"
";
newdiv.innerHTML = newdivtxt;
newdiv.style.position = "absolute";
newdiv.style.padding = "1em";
newdiv.style.width = "22em";
newdiv.style.height = "16em";
newdiv.style.background = "#008000";
newdiv.style.border = "2px solid #000";
newdiv.style.borderRadius = "1em";
newdiv.style.zIndex = '106';
newdiv.style.left = "44%"; /*left_y + 'px';*/
newdiv.style.paddingTop = "0";
newdiv.style.textAlign = "center";
/*if (store_flag == "stores") {
newdiv.style.left = "-125px";
newdiv.style.top = "60px";
} else if (store_flag == "stores_main") {
newdiv.style.left = "435px";
newdiv.style.top = "0px";
} else {
newdiv.style.left = "230px";
newdiv.style.top = "0px";
}*/
newdiv.setAttribute("id","modal_login");
//document.getElementById("nav").style.zIndex='4'; //pesky navbar...
blackbg.style.display = "block";
blackbg.style.zIndex = "12";
div.appendChild(newdiv);
}
function modal_login_close_new() {
'use strict';
var blackbg;
jQuery("#modal_login").remove();
if (typeof(window.hold_black_background) == 'number' && window.hold_black_background > 0) {
if (document.body.contains(document.getElementById('neworder_div'))) {
//console.log('found div and setting zIndex');
document.getElementById('neworder_div').style.zIndex=1112;
} else {
//console.log("could not find neworder_div");
}
return;
}
blackbg = document.getElementById('kk_blk_overlay');
blackbg.style.display="none";
return;
}
function login_div_new(attachment_object, options_object) {
"use strict";
var div, position, top_x, left_y, newdiv, newdivtxt, image, f_url, closer, blackbg;
div = attachment_object;
position = jQuery(div).offset();
top_x = Math.round(position.top);
left_y = Math.round(position.left);
if (top_x > 135) {
top_x = top_x - 130;
}
if (left_y > 135) {
left_y = left_y - 132;
}
blackbg = document.getElementById("kk_blk_overlay");
closer = ""
+"
";
if (options_object.f_url !== "undefined") {
f_url = options_object.f_url;
}
newdiv = document.createElement("div");
newdiv.setAttribute("id", "modal_login");
//image = "
";
newdivtxt = " Log In to Continue "
+closer+"
";
newdiv.innerHTML = newdivtxt;
newdiv.style.padding = "8px";
newdiv.style.position = "absolute";
newdiv.style.paddingTop = '0';
newdiv.style.textAlign = "center";
newdiv.style.color = "black";
newdiv.style.paddingBottom = "20px";
blackbg.style.display = "block";
blackbg.style.zIndex = "11";
newdiv.style.width = "22em";
newdiv.style.height = "16em";
newdiv.style.background = "#008000";
newdiv.style.border = "2px solid #000";
newdiv.style.borderRadius = "1em";
newdiv.style.zIndex = "106";
newdiv.style.left = "44%"; /*left_y + 'px';*/
newdiv.style.top = top_x + 'px';
if (document.body.contains(document.getElementById("neworder_div"))) {
document.getElementById("neworder_div").style.zIndex=10;
}
if (options_object.left !== "undefined") {
newdiv.style.left = left_y + options_object.left;
}
if (options_object.right !== "undefined") {
newdiv.style.right = options_object.right;
}
if (options_object.top !== "undefined") {
newdiv.style.top = top_x + options_object.top;
}
if (options_object.bottom !== "undefined") {
newdiv.style.bottom = options_object.bottom;
}
if (options_object.zIndex !== "undefined") {
newdiv.style.zIndex = options_object.zIndex;
}
document.body.appendChild(newdiv);
};