/*
readCookie(name)
createXMLHttpRequest()
function dFilter (key, textbox, dFilterMask)
function hideDOM(id)
function showugcDOMlid(id,lid)
function showugcDOM(id)
function showugcerrorDOM(errortext)
function addressvalidation(formtype)
function sendaddress()?
function getPBSdata(lid,id,code)
function sendcatkeys()
function getHopdata(lid)
function sendhop()
function sendpayment()
function sendspecialities()
function sendcustomersserved()
function checkphotouploadstatus()
function getphotos(lid)
function searchcategories()
function addcategoriestocookies() ?
function postPSFTWEdata(formtype)
function sendemailtoLIGandcallabook(mydirurlp)
function showmouseoverphotoinfodiv(cellno,lid)
sendemailtouserforphotos
checkloginandcallabook();
function resetHopdata(lid)
*/
/**
* ajax State Description
* 0 The request is not initialized
* 1 The request has been set up
* 2 The request has been sent
* 3 The request is in process
* 4 The request is complete
*/
///spfs/server/test_ugc/apache-tomcat-5.5.20/logs/UGC
/*function setcurrentstate(state)
{
alert(state);
}*/
function deleteugccookiesonpageload()
{
delete_cookie("anyattributechanged");
delete_cookie("anyLIFcookiechanged");
delete_cookie("anyLIFcheckboxcookiechanged");
delete_cookie("x");
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++){
if(cookies[i].match("Suggested%20Category%20"))delete_cookie(cookies[i]);
if(cookies[i].match("Delete%20Categories:+"))delete_cookie(cookies[i]);
if(cookies[i].match("ugcForm"))delete_cookie(cookies[i]);
}
//document.getElementById('chbusiness1').checked=false;
}
function deleteugccookies()
{
delete_cookie("x");
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++){
if(cookies[i].match("Suggested%20Category%20"))delete_cookie(cookies[i]);
if(cookies[i].match("Delete%20Categories:+"))delete_cookie(cookies[i]);
if(cookies[i].match("ugcForm"))delete_cookie(cookies[i]);
}
}
var g_businesschboxchecked="false";
function createxcookieonlyforbusiness()
{
g_businesschboxchecked="true";
//document.getElementById('chbusiness1').checked=false;
document.cookie='x='+'This listing is out of business. ';
document.cookie ='anyLIFcheckboxcookiechanged=yes';
//document.getElementById('chbusiness1').checked=false;
}
function getpageheight1()
{
var winW = 630, winH = 460;
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {
winW = window.innerWidth;
winH = window.innerHeight;
}
if (navigator.appName.indexOf("Microsoft")!=-1) {
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
}
//alert("Window width = "+winW+"Window height = "+winH);
return { width: parseInt(winW), height: parseInt(winH) };
}
function getPageHeight(){
var winWidth, winHeight, d=document;
if (typeof window.innerWidth!='undefined') {
winWidth = window.innerWidth;
winHeight = window.innerHeight;
} else if ( d.documentElement && typeof d.documentElement.clientWidth!='undefined' && d.documentElement.clientWidth!=0 )
{
winWidth = d.documentElement.clientWidth;
winHeight = d.documentElement.clientHeight;
}
else
if ( d.body && typeof d.body.clientWidth!='undefined') {
winWidth = d.body.clientWidth;
winHeight = d.body.clientHeight;
}
winHeight=winHeight+1500;
//alert('winWidth: ' + winWidth
//+ '\nwinHeight: ' + winHeight );
return { width: parseInt(winWidth), height: parseInt(winHeight) };
}
function getBrowserHeight() {
var intH = 0;
var intW = 0;
if(typeof window.innerWidth == 'number' ) {
intH = window.innerHeight;
intW = window.innerWidth;
}
else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
intH = document.documentElement.clientHeight;
intW = document.documentElement.clientWidth;
}
else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
intH = document.body.clientHeight;
intW = document.body.clientWidth;
}
return { width: parseInt(intW), height: parseInt(intH) };
}
function setLayerPosition() {
var shadow = document.getElementById("shadow");
var question = document.getElementById("question");
//var bws = getBrowserHeight();
var bws = getPageHeight();
//var bws = getpageheight1();
shadow.style.width = bws.width + "px";
shadow.style.height = bws.height + "px";
question.style.left = parseInt((bws.width - 350) / 2);
question.style.top = parseInt((bws.height - 1200) / 2);
shadow = null;
question = null;
}
function showLayer() {
setLayerPosition();
var shadow = document.getElementById("shadow");
var question = document.getElementById("question");
shadow.style.display = "block";
question.style.display = "block";
shadow = null;
question = null;
}
function hideLayer() {
document.getElementById('chbusiness1').checked=false;
var shadow = document.getElementById("shadow");
var question = document.getElementById("question");
shadow.style.display = "none";
question.style.display = "none";
shadow = null;
question = null;
}
window.onresize = setLayerPosition;
window.onload = deleteugccookiesonpageload;
var anyattcookie; //this cookie set to 'yes', if any one of 'post'forms/factfact forms submitted successfully
var anyLIFcookie;//anylistingincorrectformcookie //this cookie set to 'yes', if any one of the listing incorrect forms submitted /PhoneFaxTollfreeAddressCategories
var gformtype;
var listingno;
var hopdatServ = 'soaprd1.superpages.com:7011';
var urldatServ = 'http://nbttest1.superpages.com:9015';
var formmail = 'http://www-int.superpages.com/cgi-bin/formmail.pl';
var grandno=null;
var thisdiv="";
var match;
///////////////////Begin-Utility functions////////////////////////////////////////////////
/* textfield assigned with a id on the form , get that element(textfiled) with that id and disable it */
function disabletextfield(textfieldid)
{
var tf=document.getElementById(textfieldid);
tf.disabled = true;
}
/* textfield assigned with a id on the form , get that element(textfiled) with that id and enable it*/
function enabletextfield(textfieldid)
{
var tf=document.getElementById(textfieldid);
tf.disabled = false;
}
/* ?? */
function setSelectionRange(input, selectionStart, selectionEnd) {
if (input.setSelectionRange) {
input.focus();
input.setSelectionRange(selectionStart, selectionEnd);
}
else if (input.createTextRange) {
var range = input.createTextRange();
range.collapse(true);
range.moveEnd('character', selectionEnd);
range.moveStart('character', selectionStart);
range.scrollIntoView();
range.select();
}
}
/* ?? */
function selectString (input, string) {
var match = new RegExp(string, "i").exec(input.value);
if (match) {
setSelectionRange (input, match.index, match.index + match[0].length);
}
}
/* returns the value of the name cookie */
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0)
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
}
// [dFilter] - A Numerical Input Mask for JavaScript
// Written By Dwayne Forehand - March 27th, 2003
// Please reuse & redistribute while keeping this notice.
function dFilterStrip (dFilterTemp, dFilterMask)
{
var dFilterStep;
dFilterMask = replace(dFilterMask,'#','');
for (dFilterStep = 0; dFilterStep < dFilterMask.length++; dFilterStep++)
{
dFilterTemp = replace(dFilterTemp,dFilterMask.substring(dFilterStep,dFilterStep+1),'');
}
return dFilterTemp;
}
function dFilterMax (dFilterMask)
{
dFilterTemp = dFilterMask;
for (dFilterStep = 0; dFilterStep < (dFilterMask.length+1); dFilterStep++)
{
if (dFilterMask.charAt(dFilterStep)!='#')
{
dFilterTemp = replace(dFilterTemp,dFilterMask.charAt(dFilterStep),'');
}
}
return dFilterTemp.length;
}
function dFilter (key, textbox, dFilterMask)
{
dFilterNum = dFilterStrip(textbox.value, dFilterMask);
if (key==9)
{
return true;
}
else if (key==8&&dFilterNum.length!=0)
{
dFilterNum = dFilterNum.substring(0,dFilterNum.length-1);
}
else if ( ((key>47&&key<58)||(key>95&&key<106)) && dFilterNum.length<dFilterMax(dFilterMask) )
{
if(key>95&&key<106)
{
switch(key){case 96: dFilterNum=dFilterNum+'0'; break; case 97: dFilterNum=dFilterNum+'1'; break;
case 98: dFilterNum=dFilterNum+'2'; break; case 99: dFilterNum=dFilterNum+'3'; break;
case 100: dFilterNum=dFilterNum+'4'; break; case 101: dFilterNum=dFilterNum+'5'; break;
case 102: dFilterNum=dFilterNum+'6'; break; case 103: dFilterNum=dFilterNum+'7'; break;
case 104: dFilterNum=dFilterNum+'8'; break; case 105: dFilterNum=dFilterNum+'9'; break;}
}
else
{
dFilterNum=dFilterNum+String.fromCharCode(key);
}
}
else if ( ((key == 45)||(key == 35)||(key == 40)||(key == 34)||(key == 37)||(key == 12)||(key == 39)||(key == 36)||(key == 38)||(key == 33)) && dFilterNum.length<dFilterMax(dFilterMask) )
{
switch(key){case 45: dFilterNum=dFilterNum+'0'; break; case 35: dFilterNum=dFilterNum+'1'; break;
case 40: dFilterNum=dFilterNum+'2'; break; case 34: dFilterNum=dFilterNum+'3'; break;
case 37: dFilterNum=dFilterNum+'4'; break; case 12: dFilterNum=dFilterNum+'5'; break;
case 39: dFilterNum=dFilterNum+'6'; break; case 36: dFilterNum=dFilterNum+'7'; break;
case 38: dFilterNum=dFilterNum+'8'; break; case 33: dFilterNum=dFilterNum+'9'; break;}
}
var dFilterFinal='';
for (dFilterStep = 0; dFilterStep < dFilterMask.length; dFilterStep++)
{
if (dFilterMask.charAt(dFilterStep)=='#')
{
if (dFilterNum.length!=0)
{
dFilterFinal = dFilterFinal + dFilterNum.charAt(0);
dFilterNum = dFilterNum.substring(1,dFilterNum.length);
}
else
{
dFilterFinal = dFilterFinal + "";
}
}
else if (dFilterMask.charAt(dFilterStep)!='#')
{
dFilterFinal = dFilterFinal + dFilterMask.charAt(dFilterStep);
}
// dFilterTemp = replace(dFilterTemp,dFilterMask.substring(dFilterStep,dFilterStep+1),'');
}
//textbox.value = dFilterFinal;
//return false;
if(((textbox.id == ("ugcFormTFP" ||"ugcFormTFS" || "ugcFormTFF" || "ugcFormTFT")) && (dFilterFinal.length == 4))||((textbox.id == "zip") && (dFilterFinal.length == 1)))
{
textbox.value="";
}
else
{
textbox.value = dFilterFinal;
}
return false;
}
/* returns fullString after replacing the 'text' string with 'by' string */
function replace(fullString,text,by) {
// Replaces text with by in string
var strLength = fullString.length, txtLength = text.length;
if ((strLength == 0) || (txtLength == 0)) return fullString;
var i = fullString.indexOf(text);
if ((!i) && (text != fullString.substring(0,txtLength))) return fullString;
if (i == -1) return fullString;
var newstr = fullString.substring(0,i) + by;
if (i+txtLength < strLength)
newstr += replace(fullString.substring(i+txtLength,strLength),text,by);
return newstr;
}
/* show the div(has form)with the given id */
function showDOM(id)
{
if(id == "freecouppopup1"){
hideObject("freecouppopup2");
hideObject("freecouppopup3");}
if(id == "freecouppopup2"){
hideObject("freecouppopup1");
hideObject("freecouppopup3");}
if(id == "freecouppopup3"){
hideObject("freecouppopup1");
hideObject("freecouppopup2");}
if(id == "ugcFormA")
{
//showcurrentstate
}
dom = findDOM(id);
if (dom){
dom.style.display = "inline";
}
}
/* show the div(has form)with the given id */
function showugcDOM(id)
{
dom = findDOM(id);
if (dom){
dom.style.display = "inline";
}
}
function areArraysEqual(array1, array2) {
var temp = new Array();
if ( (!array1[0]) || (!array2[0]) ) { // If either is not an array
//alert("1");
return false;
}
if (array1.length != array2.length) {
//alert("2");
return false;
}
// Put all the elements from array1 into a "tagged" array
for (var i=0; i<array1.length; i++) {
key = (typeof array1[i]) + "~" + array1[i];
// alert("key="+key);
// Use "typeof" so a number 1 isn't equal to a string "1".
if (temp[key]) { temp[key]++; } else { temp[key] = 1; }
// temp[key] = # of occurrences of the value (so an element could appear multiple times)
}
// Go through array2 - if same tag missing in "tagged" array, not equal
for (var i=0; i<array2.length; i++) {
key = (typeof array2[i]) + "~" + array2[i];
if (temp[key]) {
if (temp[key] == 0) { return false; } else { temp[key]--; }
// Subtract to keep track of # of appearances in array2
} else
{
// Key didn't appear in array1, arrays are not equal.
// alert("3");
return false;
}
}
// If we get to this point, then every generated key in array1 showed up the exact same
// number of times in array2, so the arrays are equal.
return true;
}
function findPosX(obj)
{
var curleft = 0;
if(obj.offsetParent)
while(1)
{
curleft += obj.offsetLeft;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.x)
curleft += obj.x;
return curleft;
}
function findPosY(obj)
{
var curtop = 0;
if(obj.offsetParent)
while(1)
{
curtop += obj.offsetTop;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.y)
curtop += obj.y;
return curtop;
}
function disableAllForms(){
for(var i=0; i<document.forms.length; i++){
for(var j=0; j< document.forms[i].elements.length; j++){
document.forms[i].elements[j].disabled = true;
}
}
}
function delete_cookie ( cookie_name )
{
var cookie_date = new Date ( ); // current date & time
cookie_date.setTime ( cookie_date.getTime() - 1 );
document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}
///////////////Utility functions-End///////////////////////////////////////////////////
///////////////semi Utility functions-Begin////////////////////////////////////////////
/* hides the div whose id is id */
function hideDOM(id)
{
dom = findDOM(id);
donIfrm = findDOM("caterrorfrm");
if (dom){
dom.style.display = "none";
donIfrm.style.display = "none";
}
}
/* show the div(has form)with the given id and populate the form with the data for the given lid */
function showugcDOMlid(id,lid)
{
if((id == "ugcFormspecialties"))
{
var rightlistSp=document.getElementById('rightlistsp');
if(rightlistSp.length == 0)
getSpecialties(lid);
}
//getPBSdata--P=products-B=brands-S=services
if((id == "ugcFormproduct"))
{
getPBSdata(lid,'P');
}
if((id == "ugcFormservice"))
{
getPBSdata(lid,'S');
}
if((id == "ugcFormbrand"))
{
getPBSdata(lid,'B');
}
if((id == "ugcFormhoursofoperation"))
{
getHopdata(lid); //hours of operation
}
if( id == "viewphotos")
{
listingno = lid;
getphotos(lid);//for view photos
}
dom = findDOM(id);
if (dom){
dom.style.display = "inline";
}
}
////////////////semi Utility functions-End////////////////////////////////////
///////////////////////form functions --Begin//////////////////////////////////////
///////////////////////form function --2//////////////////////////////////////
///////////////////////form function --3//////////////////////////////////////
///////////////////////form function --4//////////////////////////////////////
/* not calling this function from any where-?? */
function showugcerrorDOM1(errortext)//previously showugcerrorDOM
{
dom = findDOM('errordiv');
if(dom){
dom.style.display = "inline";
errorcontentdom = findDOM('errorcontent');
document.getElementById('errorcontent').innerHTML = errortext;
if(errortext == 'Category information could not be updated')// || 'You have reached the maximum limit of 5 categories. you must remove/deselect a category before adding more.')
{ headingdom = findDOM('errorheading');
if(headingdom)
{
headingdom.style.display = "inline";
document.getElementById('errorheading').innerHTML = errortext;
document.getElementById('errorcontent').innerHTML = "You have reached the maximum limit of 5 categories. You must remove/deselect a category before adding more.";
}
}
else
{
hideDOM('errorheading');
}
//dom.innerHTML = errortext;
}
}
/* displays the error message on a given errormsg div for corresponding address/phone/fax/additional/tollfree/categories*/
function showugcerrorDOM(errortext, divfromwhichform)//divfromwhichform is a div around(mostly below) the actual form div
{
dom = findDOM(divfromwhichform);
domIfrm = findDOM("caterrorfrm");//overlapping of divs if listbox exist on bottom div, so special handling for categoy form
var imgLocation = imgLoc;//for ok button
if (dom){
var str="caterrordiv";
var innerhtmlerrorstr ="<div style='width:400px;' id='roundcorn1'><b class='rdtop1'><b class='rdb11'></b><b class='rdb21'></b><b class='rdb31'></b><b class='rdb41'></b>"+
"<div class='rdbordcontent1'><table border='0' width='385'>";
if(errortext == 'You have reached the maximum limit of 5 categories. You must remove/deselect a category before adding more.'){
innerhtmlerrorstr = innerhtmlerrorstr+"<tr><td class='errMsgHUgc' style='padding-left:10px;padding-top:20px;padding-bottom:10px;' align='left'><b>"+
"Category information could not be updated</b>&nbsp;</td></tr>";
}
innerhtmlerrorstr = innerhtmlerrorstr+"<tr><td class='errMsgUgc' style='padding-bottom:20px;padding-left:10px;'>"+errortext+"</td></tr><tr>"+
"<td align='right'><input style='vertical-align: bottom;' type='image'"+"type='image' src='"+imgLocation+"ok_button.gif'name='OK' title='OK' value='OK' onclick='hideDOM(";
innerhtmlerrorstr=innerhtmlerrorstr+"\""+divfromwhichform+"\"";
innerhtmlerrorstr=innerhtmlerrorstr+");return false;'>"+
"</td></tr></table>"+
"</div><b class='rdbottom1'><b class='rdb41'></b><b class='rdb31'></b><b class='rdb21'></b><b class='rdb11'></b></b></div>";
dom.innerHTML =innerhtmlerrorstr;
dom.style.display = "inline";
if((errortext == 'You have reached the maximum limit of 5 categories. You must remove/deselect a category before adding more.')||('Enter a search term.')||('There are no matching categories available.')){
domIfrm.style.width = dom.offsetWidth;
domIfrm.style.height = dom.offsetHeight;
domIfrm.style.top = dom.style.top;
domIfrm.style.left = dom.style.left;
domIfrm.style.zIndex = dom.style.zIndex - 1;
domIfrm.style.display = "block";
}
}
}
/* ?? */
function addcategoriestocookies()
{
var suggestedexist="false";
anyLIFcookie=readCookie('anyLIFcookiechanged');
if((!anyLIFcookie))
document.cookie ='anyLIFcookiechanged=yes';
var delcats=document.getElementById("Delete Categories: ");//hidden input field
if(delcats != null || delcats !="")
{
var delcat = delcats.value;
delcat = delcat.replace(/\&/g,"%26");
document.cookie ='Delete%20Categories:+='+delcat;//write to cookie
var read=readCookie('Delete%20Categories:+');
delcats.value="";
}
for(var i=1;i<=5;++i)
{
var suggested=document.getElementById("Suggested Category "+i+": ");
if((suggested.value != null)&&(suggested.value != ""))
{
suggestedexist="true";
var suggestedcat = suggested.value;
suggestedcat = suggestedcat.replace(/\&/g,"%26");
document.cookie =escape('Suggested Category ')+i+':%20='+suggestedcat;//write to cookie
var read=readCookie('Suggested%20Category%20'+i+':%20');
suggested.value="";
}
}
hideDOM('ugcFormcategory');
anyattcookie=readCookie('anyattributechanged');
if((!anyattcookie)){
document.cookie ='anyattributechanged=yes';
hideDOM('beforeattribchange');
if(suggestedexist || ((delcats.value != null && delcats.value !="")))
showugcDOM('afterattribchange');
else
showDOM('beforeattribchange');
}
else
{
hideDOM('beforeattribchange');
var tmp=(((delcats.value != null && delcats.value !="" )) ||(suggestedexist)) ;
if(tmp == true){
showugcDOM('afterattribchange');}
else{
showDOM('beforeattribchange');}
}
}
///////////////validation function 1--BEGIN///////////////////////////////////////////
function addressvalidation(formtype, prodId, label)
{
clickTrackUGC('UGC',prodId,label);
if(formtype == 'A')
{
if(document.getElementById("ugcFormstreet").value == '')//text field
{
showugcerrorDOM('Please enter a Street','adderrordiv');
return false;
}
if(document.getElementById("ugcFormcity").value == '')//text field
{
showugcerrorDOM('Please enter a City','adderrordiv');
return false;
}
if(document.getElementById("ugcFormzip").value == '')//text field
{
showugcerrorDOM('Please enter a Zip Code','adderrordiv');
return false;
}
}
anyLIFcookie=readCookie('anyLIFcookiechanged');
if((!anyLIFcookie))
document.cookie ='anyLIFcookiechanged=yes';
var street,city,state,zip;
street="Street:+current = "+encodeURI( document.getElementById("ugcFormCstreet").value)+"+| suggested+"+" "+encodeURI( document.getElementById("ugcFormstreet").value );
city="City:+current = "+encodeURI( document.getElementById("ugcFormCcity").value)+"+| suggested+"+" "+encodeURI( document.getElementById("ugcFormcity").value );
state="State:+current = "+encodeURI( document.getElementById("ugcFormCstate").value)+"+| suggested+"+" "+encodeURI( document.getElementById("ugcFormstate").value );
zip="Zip:+current = "+encodeURI( document.getElementById("ugcFormCzip").value)+"+| suggested+"+" "+encodeURI( document.getElementById("ugcFormzip").value );
document.cookie ='ugcFormstreet='+street;
document.cookie ='ugcFormcity='+city;
document.cookie ='ugcFormstate='+state;
document.cookie ='ugcFormzip='+zip;
hideDOM('ugcFormA');
anyattcookie=readCookie('anyattributechanged');
if((!anyattcookie)){
document.cookie ='anyattributechanged=yes';
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
else
{
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
/* this gets called from rolodex forms*/
function postPSFTWEdata(formtype, prodId, label) {
//clickTrackUGC('UGC',prodId,label);
gformtype='ugcForm'+formtype;
/////////////////form validations begin///////////////////////////
var ele=document.getElementById('ugcFormTF'+formtype);
if(formtype == 'P' || formtype == 'S' || formtype == 'F' || formtype == 'T')
{
var type='';
if(formtype == 'P') type="phone";if(formtype == 'S') type="secondary phone"; if(formtype == 'F') type="fax"; if(formtype == 'T') type="tollfree";
if(ele.value == '')
{
showugcerrorDOM('Please enter '+type, 'phoneerrordiv');
return false;
}
}
if(formtype == 'W')//website
{
if(ele.value == '' || ele.value == 'undefined')
{
showugcerrorDOM('Please enter a URL', 'websiteerrordiv');
return false;
}
var urlRegxp = /^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([\w]+)(.[\w]+){1,2}$/;
if (urlRegxp.test(ele.value) != true)
{
showugcerrorDOM('Please enter a valid URL', 'websiteerrordiv');
return false;
}
}
if(formtype == 'E')//email
{
if(ele.value == '')
{
showugcerrorDOM('Please enter an email address', 'emailerrordiv');
return false;
}
var emailRegxp = /^([\w]+)(.[\w]+)*@([\w]+)(.[\w]{2,3}){1,2}$/;
if (emailRegxp.test(ele.value) != true)
{
showugcerrorDOM('Please enter a valid email address','emailerrordiv');
return false;
}
}
/////////////////form validations end/////////////////////////////
// http://spdev.superpages.com/cgi-bin/encryptemail.pl
//dG9wbTEyM0B5YWhvby5jb20
// var poststr = "sprecipient="+document.getElementById("sprecipient").value+"&ugcFormTF"+formtype+"=" + encodeURI( document.getElementById("ugcFormTF"+formtype).value );
anyLIFcookie=readCookie('anyLIFcookiechanged');
if((!anyLIFcookie))
document.cookie ='anyLIFcookiechanged=yes';
// document.cookie ='ugcFormTF'+formtype+'='+encodeURI( document.getElementById("ugcFormTF"+formtype).value );
var str;
var delstr;
var delstrformatch;
if(formtype == 'B'){str="Business+Name"; }
if(formtype == 'P'){str="Phone+Number"; }
if(formtype == 'F'){str="Fax+Number"; delstr="fax"; delstrformatch="fax";}
if(formtype == 'T'){str="Toll+Free+Number"; delstr="toll free"; delstrformatch="toll free";}
if(formtype == 'S'){str="Additional+Phone+Number"; delstr="additional"; delstrformatch="additional";}
if(formtype == 'W'){str="Web+Site+URL"; delstr="fax+number";}
if(formtype == 'E'){str="Email+Address"; delstr="email address"; delstrformatch="email address";}
//alert(formtype);
//alert(document.getElementById("ugcFormTF"+formtype).value);
//alert(document.getElementById("ugcFormTF"+formtype).disabled );
//Phone Number: current = (508) 478-3425 | suggested = (508) 478-3428
if(!(document.getElementById("ugcFormTF"+formtype).disabled))
{
var cur=findDOM("ugcFormC"+formtype).value;
//cur=cur.replace(/\&/g,"%26");
var sug=findDOM("ugcFormTF"+formtype).value;
//sug=sug.replace(/\&/g,"%26");
//findDOM("ugcFormC"+formtype).value
//encodeURI
if(formtype == 'B')
{
str=str + ":+current =" +(encodeURIComponent(cur ))+ "+| suggested+" + " " +encodeURIComponent( sug);
}
else
{
str=str + ":+current =" +(encodeURI(findDOM("ugcFormC"+formtype).value ))+ "+| suggested+" + " " +encodeURI( findDOM("ugcFormTF"+formtype).value );
}
document.cookie ='ugcFormTF'+formtype+'='+str;
}
else
{
var xcookieval=readCookie('x');
//alert(xcookieval);
if(xcookieval == null)
{
if(formtype == 'E')
{
document.cookie='x='+'Delete the business '+delstrformatch+'. ';
}
else
document.cookie='x='+'Delete the business '+delstrformatch+' number. ';
}
else
{
if(!xcookieval.match(delstrformatch)){
//document.cookie='xcookie='+xcookieval+'Delete the business '+delstrformatch+' number.+';
delete_cookie("x");
//document.cookie=xcookieval+'Delete the business '+delstrformatch+' number. ';
if(formtype == 'E')
{
document.cookie='x='+xcookieval+'Delete the business '+delstrformatch+'. ';
}
else
document.cookie='x='+xcookieval+'Delete the business '+delstrformatch+' number. ';
}
}
xcookieval=readCookie('x');
//alert("$"+xcookieval);
}
hideDOM(gformtype);
anyattcookie=readCookie('anyattributechanged');
if((!anyattcookie)){
document.cookie ='anyattributechanged=yes';
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
else
{
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
/*anyattcookie=readCookie('anyLIFcookiechanged');
if((!anyattcookie)){
document.cookie ='anyLIFcookiechanged=yes';
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
else
{
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}*/
}
////9**********POST send changed PSFTEW-rolodex forms--END*****************************************///
//8*************GET and POST categories--BEGIN**************************************//
var xmlHttp;
function searchcategories()
{
//http://nbt.superpages.com:8081/nbt/search/xmlbean?ENGINE=taxonomy&C=auto
var searchterm = document.getElementById('searchterm');
if(searchterm.value == null || searchterm.value =='')
{
showugcerrorDOM("Enter a search term.", 'caterrordiv');
return;
}
if(searchterm != null)
{
if (typeof ActiveXObject != "undefined") {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent('http://nbt.superpages.com:8081/nbt/search/xmlbean?ENGINE=taxonomy&C='+searchterm.value);
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = handleCategorySearchStateChange;
xmlHttp.send(null);
}
else
{
//alert("enter search string");
}
}
function handleCategorySearchStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
var leftcategorylist =document.getElementById('leftlistc');
var selectbox=document.getElementById("rightlistc");
// if(selectbox.length == 0 || leftcategorylist.length == 0)
parseCategorySearchResults();
}
}
}
function parseCategorySearchResults() {
var leftcategorylist =document.getElementById('leftlistc');
var root = xmlHttp.responseXML;
var searchterm = document.getElementById('searchterm');
//if(searchterm.value == null || searchterm.value =='')
if((xmlHttp.responseText=="<nodes></nodes>") ||(xmlHttp.responseText=="" &&((searchterm.value != null || searchterm.value !='')) ) ){
showugcerrorDOM("There are no matching categories available.", 'caterrordiv');
return;
}
// var longterms = new Array();
var longterms= root.getElementsByTagName("longTerm");
//var result= root.getElementsByTagName("longTerm").value;
//get sorted array as input and returns the same array without duplicates.
var result=new Array();
var lastValue="";
for (var i=0; i<longterms.length; i++)
{
var curValue=longterms[i].firstChild.nodeValue;
if (curValue != lastValue)
{
result[result.length] = curValue;
}
lastValue=curValue;
}
//var option = null;
////////////////Select xxx to Remove////
/* option = document.createElement("option");
option.appendChild(document.createTextNode("->Select Categories to Add"));
option.value="->Select Categories to Add";
leftcategorylist.appendChild(option);*/
result=result.sort();
var option = null;
for (var loop = 0; loop < result.length; loop++) {
option = document.createElement("option");
option.appendChild(document.createTextNode(result[loop]));
option.value=result[loop];
leftcategorylist.appendChild(option);
}
}
/////////////END categories/////////////////////////////////////////////
function CmoveOptions(theSelFrom, theSelTo, prodId, label)
{
clickTrackUGC('UGC',prodId,label);
// var theSelFrom =document.getElementById("leftlist"+listboxid);
//var theSelTo =document.getElementById("rightlist"+listboxid);
var selLength = theSelFrom.length;
var seltoLength = theSelTo.length;
if(theSelFrom.length == 0)
//if(theSelFrom.length == 1)
{
return false;
}
//o if(theSelTo.length > 4)
if(theSelTo.length > 5)
{
if(!theSelFrom.options[0].selected)
showugcerrorDOM("You have reached the maximum limit of 5 categories. You must remove/deselect a category before adding more.", 'caterrordiv');
// showugcerrorDOM("You have reached the maximum limit of 5 categories. you must remove/deselect a category before adding more.");
return false;
}
var selectedText = new Array();
var selectedValues = new Array();
var selectedCount = 0;
var i;
// Find the selected Options in reverse order
// and delete them from the 'from' Select.
//o for(i=selLength-1; i>=0; i--)
for(i=selLength-1; i>=1; i--)
//for(i=selLength-1; i>=1; i--)
{
if(theSelFrom.options[i].selected)
{
selectedText[selectedCount] = theSelFrom.options[i].text;
selectedValues[selectedCount] = theSelFrom.options[i].value;
// deleteOption(theSelFrom, i);
selectedCount++;
}
}
// Add the selected text/values in reverse order.
// This will add the Options to the 'to' Select
// in the same order as they were in the 'from' Select.
var alreadyexist=false;
for(i=selectedCount-1; i>=0; i--)
{
// addOption(theSelTo, selectedText[i], selectedValues[i]);
for(var j=0; j < seltoLength; ++j)
{
if(theSelTo.options[j].text == selectedText[i])
{
//theSelTo.options[theSelTo.options.length]=new Option(selectedText[i],selectedValues[i],true,true);
alreadyexist=true;
break;
}
}
if(!alreadyexist)
{
theSelTo.options[theSelTo.options.length]=new Option(selectedText[i],selectedValues[i],true,true);
for(var c=1;c<=5;++c)
{
var suggested=document.getElementById("Suggested Category "+c+": ");
if(suggested.value == null || suggested.value == "")
{
suggested.value = selectedValues[i];
break;
}
}
}
alreadyexist=false;
}
}
function CDoRemove()
{
var selectbox=document.getElementById("rightlistc");
var i;
for(i=selectbox.options.length-1;i>=1;i--)
{
if(selectbox.options[i].selected){
var delcats=document.getElementById("Delete Categories: ");
var delcatsappend=delcats.value;
if(delcatsappend == '' || delcatsappend == null )
{
delcats.value=selectbox.options[i].text;
}else
{
delcats.value=delcatsappend+",%20"+selectbox.options[i].text;
}
selectbox.remove(i);}
}
}
function resetCats(lid)
{
/*var searchterm=document.getElementById('searchterm');
searchterm.value="";
var leftcatlist =document.getElementById('leftlistc');
for(i=leftcatlist.options.length;i>=1;i--)
{
leftcatlist.remove(i);
}
*/
var rightcatlist =document.getElementById('rightlistc');
for(i=rightcatlist.options.length;i>=1;i--)
{
rightcatlist.remove(i);
}
getCats(lid);
}
var getcatsreq=null;
function getCats(lid)
{
//var url='http://nbttest1.superpages.com:9080/ugcwiki/GetCatKeyServlet?listingid='+lid+'&attributeCode='+code+'&userId=tester';
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/GetDataServlet?lid='+lid);
if (typeof ActiveXObject != "undefined") {
getcatsreq = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
getcatsreq = new XMLHttpRequest();
}
getcatsreq.onreadystatechange = categoriescallback;
getcatsreq.open("GET", url, true);
getcatsreq.send(null);
}
function categoriescallback() {
if (getcatsreq.readyState == 4) {
if (getcatsreq.status == 200) {
var rightcatslist =document.getElementById('rightlistc');
if(rightcatslist.length == 1)
parsecategoriesMessage();
}
}
}
var xxgrightcatkeylistlength;
function parsecategoriesMessage1() {
//alert("xml="+getcatsreq.responseText);
}
function parsecategoriesMessage() {
var rightcatslist =document.getElementById('rightlistc');
//alert("xml="+getcatsreq.responseText);
//var root = getcatsreq.responseXML;//.getElementsByTagName('CatKeys')[0];
//var cats= getcatsreq.getElementsByTagName("category");
//var cats=getcatsreq.responseXML.getElementsByTagName('category');
var cats=getcatsreq.responseXML.getElementsByTagName("category");
//var message = req.responseXML.getElementsByTagName("message")[0];
//photodownloadreq.responseXML.getElementsByTagName("title");
//var cats = root.getElementsByTagName("category");
//alert(cats.length);
var option = null;
for (loop = 0; loop < cats.length; loop++) {
option = document.createElement("option");
option.appendChild(document.createTextNode(cats[loop].firstChild.nodeValue));
option.value=cats[loop].firstChild.nodeValue;
rightcatslist.appendChild(option);
}//for
}
/////////////////////category form end////////////////////////////
//*8**************GET and POST categories--END****************************************//
function authenticateurl(urllid)
{
if((document.getElementById("ugcFormTFW").disabled))
{
var xcookieval=readCookie('x');
//alert(xcookieval);
if(xcookieval == null)
{
document.cookie='x='+'Delete the buisness website. ';
}
else
{
if(!xcookieval.match("website")){
//document.cookie='xcookie='+xcookieval+'Delete the business '+delstrformatch+' number.+';
delete_cookie("x");
//document.cookie=xcookieval+'Delete the business '+delstrformatch+' number. ';
document.cookie='x='+xcookieval+'Delete the business website. ';
}
}
xcookieval=readCookie('x');
//alert("$"+xcookieval);
hideDOM("ugcFormW");
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
return;
}
////////////////////////////////////////////////
var ele=document.getElementById('ugcFormTFW');
if(ele.value == ''){
dom=findDOM("websiteerror");
var errormsg="";
errormsg=" Please enter a website name";
if(dom)
{
var errordiv=document.getElementById("websiteerror");
errordiv.innerHTML=errormsg;
dom.style.display="inline";
}
}
else
{
if (typeof ActiveXObject != "undefined") {
oXmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
oXmlHttp = new XMLHttpRequest();
}
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(urldatServ+'/axis2/services/ADPortalWebService/ValidateURLReq?Url='+ele.value+'');
oXmlHttp.open("GET", url, false);
oXmlHttp.setRequestHeader("Content-Type", "text/xml");
oXmlHttp.send(null);
var root = oXmlHttp.responseXML;
var status=root.getElementsByTagName("Status");
var contents=root.getElementsByTagName("Contents");
if(((status[0].text == 'Valid')||(status[0].textContent == 'Valid')) &&((contents[0].text == 'Appropriate')||(contents[0].textContent == 'Appropriate')))
{
sendurl(ele.value,urllid);
}
else
{
dom=findDOM("websiteerror");
var errormsg="";
if((status[0].text != 'Valid') || (status[0].textContent != 'Valid'))
{
errormsg=" Please enter a valid website name";
}
if(((status[0].text == 'Valid')||(status[0].textContent == 'Valid'))&&((contents[0].text != 'Appropriate')||(contents[0].textContent != 'Appropriate')))
{
errormsg=" Please enter an appropriate website name";
}
if(dom)
{
var errordiv=document.getElementById("websiteerror");
errordiv.innerHTML=errormsg;
dom.style.display="inline";
}
}
}
}
var xmlHttp;
function sendurl(eurl, urllid)
{
if (typeof ActiveXObject != "undefined") {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
var spc=document.getElementById('SPC');
var spcuid=document.getElementById('SPCUIDE');
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/UpdateBPServlet?listingid='+urllid+'&attributeCode=WebsiteURL&sourceType=UGCUT&userId=tester'+'&SPC='+spc.value+'&SPCUID='+spcuid.value);
var xml="<All><Description>"+eurl+"</Description></All>";
xmlHttp.open("POST", url, true);
xmlHttp.onreadystatechange = handleurlStateChange;
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
xmlHttp.send(xml);
}
function handleurlStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
parseurlResults();
}
}
}
function parseurlResults() {
var message = xmlHttp.responseXML.getElementsByTagName("Success")[0];
anyattcookie=readCookie('anyattributechanged');
if(message.childNodes[0].nodeValue == 0 )
{
hideDOM('ugcFormW');
hideDOM('beforeattribchange');
if((!anyattcookie)){
document.cookie ='anyattributechanged=yes';
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
else
{
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
if(anyattcookie){
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
var globaladdresscheckbox='no';
var globalphonecheckbox='no';
function changeconfirmation(checkboxgroup,chboxno)
{
//alert(checkboxgroup);
//var oneormorecheckboxescheckedP='no';
//var oneormorecheckboxescheckedA='no';
//var oneormorecheckboxescheckedB='no';
var oneormorecheckboxeschecked='no';
if(checkboxgroup== 'phone')
{
globalphonecheckbox='yes';
//var mainphonemsg=document.getElementById("mainphonemsg");
dom= findDOM("mainphonemsg");
if(document.getElementById('chphone'+chboxno).checked)
{
//mainphonemsg.display="inline";
if(dom){
dom.style.display = "inline";
}
oneormorecheckboxeschecked='yes';
for(var i=1;i<=4;++i)
{
if(i != chboxno )
{
document.getElementById('chphone'+i).disabled=true;
}
}
}
else
{
//oneormorecheckboxescheckedP='no';
//globalphonecheckbox='no';
//oneormorecheckboxeschecked='no';
//mainphonemsg.display="none";
if(dom){
dom.style.display = "none";
}
for(var i=1;i<=4;++i)
{
if(i != chboxno )
{
document.getElementById('chphone'+i).disabled=false;
}
}
}
/*for(var i=1;i<=4;++i)
{
if(!(document.getElementById('chphone'+i).checked))
{
document.getElementById('chphone'+i).disabled=true;
}
}*/
}
if(checkboxgroup== 'address')
{
globaladdresscheckbox='yes';
if(document.getElementById('chaddress'+chboxno).checked)
{
oneormorecheckboxeschecked='yes';
for(var i=1;i<=2;++i)
{
if(i != chboxno )
{
document.getElementById('chaddress'+i).disabled=true;
}
}
}
else
{
//oneormorecheckboxescheckedA='no';
for(var i=1;i<=2;++i)
{
if(i != chboxno )
{
document.getElementById('chaddress'+i).disabled=false;
}
}
}
}
if(document.getElementById('chbusiness1').checked)
{
oneormorecheckboxeschecked="yes";
}
var othercheckboxgroupitemschecked='no';
var addchgroupexist=document.getElementById('Achgroupexist').value;
var phonechgroupexist=document.getElementById('Pchgroupexist').value;
if(phonechgroupexist == "exist")
{
for(var i=1;i<=4;++i)
{
if((document.getElementById('chphone'+i).checked))
{
othercheckboxgroupitemschecked='yes';
}
}
}
if(addchgroupexist == "exist")
{
for(var i=1;i<=2;++i)
{
if((document.getElementById('chaddress'+i).checked))
{
othercheckboxgroupitemschecked='yes';
}
}
}
//alert("ttt="+addchgroupexist);
//if((oneormorecheckboxescheckedP == "yes") ||(oneormorecheckboxescheckedA == "yes")||(oneormorecheckboxescheckedB == "yes") )
if((oneormorecheckboxeschecked == "yes")||(othercheckboxgroupitemschecked == "yes"))
//if((oneormorecheckboxeschecked == "yes")||(addchgroupexist == "exist")||(phonechgroupexist == "exist"))
{
oneormorecheckboxeschecked='no';
othercheckboxgroupitemschecked='no';
/*anyLIFcookie=readCookie('anyLIFcookiechanged');
if((!anyLIFcookie)){
document.cookie ='anyLIFcookiechanged=yes'; */
anyLIFcheckboxcookie=readCookie('anyLIFcheckboxcookiechanged');
if((!anyLIFcheckboxcookie)){
document.cookie ='anyLIFcheckboxcookiechanged=yes';
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
else
{
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
else
{
delete_cookie("anyLIFcheckboxcookiechanged");
//delete_cookie("anyattributechanged");
anyattributechanged=readCookie('anyattributechanged');//other thank checkbox items(rolodex forms and factfact forms)
var cookies = document.cookie.split(";");
//remove b
/*for (var i =(cookies.length -1); i >=0; i--){
//w cookiePair = cookies[i].split("=");
if(cookies[i].match("anyattributechanged"))alert("anyLIFcookiechanged cookie="+cookies[i]);
}*/
//remove e
if((!anyattributechanged)){
hideDOM('afterattribchange');
showugcDOM('beforeattribchange');
}
}
}
function addcheckboxitemstoxcookie(id)
{
//alert("&"+document.getElementById(id).checked);
//alert(document.getElementById(id).value);
//alert(id);
//alert("addcheckboxitemstoxcookie");
if(document.getElementById(id).checked)
{
var xcookieval=readCookie('x');
//alert(xcookieval);
if(xcookieval == null)
{
var xcookieitem = document.getElementById(id).value;
xcookieitem=xcookieitem.replace(/\&/g,"%26");
document.cookie='x='+xcookieitem+'. ';
}
else
{
if(!xcookieval.match(document.getElementById(id).value)){
//document.cookie='xcookie='+xcookieval+'Delete the business '+delstrformatch+' number.+';
delete_cookie("x");
//document.cookie=xcookieval+'Delete the business '+delstrformatch+' number. ';
document.cookie='x='+xcookieval+document.getElementById(id).value+'. ';
}
}
xcookieval=readCookie('x');
//alert("$"+xcookieval);
}
}
function returnTrue() { return true; }
function returnFalse() { return false }
/* read all links(<a href="...">xyz</a>) on a page and make them disbale/non clickable for the links whose href value is javascript:;*/
function readlinks()
{
//alert(document.links.href.match("javascript:;").length);
//if(document.getElementById('chbusiness1').checked)alert("checked");
//if(!document.getElementById('chbusiness1').checked)alert("unchecked");
for (i=0; i < document.links.length; i++)
{
//alert(document.links[i].href);
if(document.links[i].href.match("javascript:;"))
{
//alert("hh");
if(document.getElementById('chbusiness1').checked)
{
//document.links[i].disabled="true";
//document.links[i].visibility="true";
document.links[i].display="none";
//document.links[i].onclick="false";
//document.links[i].onclick="true";
//document.links[i].onclick = false;
//document.links[i].disabled="vcx";
//document.links[i].onclick="xcv";
//document.links[i].style.cursor="pointer";
}
/*else
{
if(i == 1)alert("unchecked");
document.links[i].disabled="true";
document.links[i].onclick="false";
}*/
}
if(!document.getElementById('chbusiness1').checked)
{
//if(document.links[i].href.match("javascript:;"))
//{alert("gg");
//document.links[i].onclick="true";
//document.links[i].disabled = false;
//document.links[i].visibility="";
document.links[i].display="none";
//document.links[i].style.cursor="hand";
//document.links[i].onclick= "true";
//document.links[i].onclick=returnTrue;
//document.links[i].style.textDecoration="underline";
//document.links[i].style.cursor="pointer";
//}
}
}
}
///////////////validation function 1--END///////////////////////////////////////////
//////////////////////////////1.1**********GET PBS--BEGIN********/////////////////////
var req;
var listboxid;
var lid;
var xmlHttp;
function getPBSdata(lidp,code)
{
lid=lidp;
if(code == "P") { listboxid='p'; }
if(code == "S") { listboxid='s'; }
if(code == "B") { listboxid='b'; }
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/GetCatKeyServlet?listingid='+lid+'&attributeCode='+code+'&userId=tester');
if (typeof ActiveXObject != "undefined") {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = handlePBSDataStateChange;
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
xmlHttp.send(null);
}
function handlePBSDataStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
var root = xmlHttp.responseXML.getElementsByTagName('CatKeys')[0];
var leftcatkeylist =document.getElementById('leftlist'+listboxid);
var rightcatkeylist =document.getElementById('rightlist'+listboxid);
if(leftcatkeylist.length == 0)
parsePBSMessage(root);
}
}
}
var productglobaltermidarray = new Array();
var serviceglobaltermidarray = new Array();
var brandglobaltermidarray = new Array();
function parsePBSMessage(root)
{
var grightcatkeylistlength;
var leftcatkeylist =document.getElementById('leftlist'+listboxid);
var rightcatkeylist =document.getElementById('rightlist'+listboxid);
var all = root.getElementsByTagName("All");
var catkeys = all[0].getElementsByTagName("Description");
var option = null;
////////////Select xxx to Add////////
option = document.createElement("option");
var strtype;
if(listboxid == 'p')
strtype = 'Products';
if(listboxid == 's')
strtype = 'Services';
if(listboxid == 'b')
strtype = 'Brands';
option.appendChild(document.createTextNode("->Select "+strtype+" to Add"));
option.value="Select "+strtype+" to Add";
option.disabled="true";
leftcatkeylist.appendChild(option);
for (loop = 0; loop < catkeys.length; loop++) {
option = document.createElement("option");
option.appendChild(document.createTextNode(catkeys[loop].firstChild.nodeValue));
option.value=catkeys[loop].firstChild.nodeValue;
leftcatkeylist.appendChild(option);
}//for
var existing = root.getElementsByTagName("Existing");
var catkeys = existing[0].getElementsByTagName("Description");
var tcatkeys = existing[0].getElementsByTagName("TermId");
var mcatkeys = existing[0].getElementsByTagName("Mark");
for (loop = 0; loop < tcatkeys.length; loop++)
{
if(listboxid == 'p')
productglobaltermidarray[loop]=tcatkeys[loop].firstChild.nodeValue;
if(listboxid == 'b')
brandglobaltermidarray[loop]=tcatkeys[loop].firstChild.nodeValue;
if(listboxid == 's')
serviceglobaltermidarray[loop]=tcatkeys[loop].firstChild.nodeValue;
}
var option = null;
option = document.createElement("option");
option.appendChild(document.createTextNode("<-Select "+strtype+" to Remove"));
option.value="Select "+strtype+" to Remove";
rightcatkeylist.appendChild(option);
for (loop = 0; loop < catkeys.length; loop++) {
option = document.createElement("option");
option.appendChild(document.createTextNode(catkeys[loop].firstChild.nodeValue));
option.value=catkeys[loop].firstChild.nodeValue+"/"+tcatkeys[loop].firstChild.nodeValue+"/"+mcatkeys[loop].firstChild.nodeValue;
if(mcatkeys[loop].firstChild.nodeValue == 'true')
{
option.style.color = "graytext";
}
rightcatkeylist.appendChild(option);
}//for
grightcatkeylistlength=rightcatkeylist.length;
}
//var req;
var lidspecialties;
var xmlHttp;
function getSpecialties(lid)
{
lidspecialties=lid;
var url = hostServ+'/bp/xmlproxy?url='+ encodeURIComponent(datServ+'/ugcwiki/GetBPServlet?listingid='+lid+'&attributeCode=Specialties');
if (typeof ActiveXObject != "undefined") {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = handleSpecialtiesDataStateChange;
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
xmlHttp.send(null);
}
function handleSpecialtiesDataStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
var root = xmlHttp.responseXML.getElementsByTagName('Terms');
parseSpecialtiesMessage(root);
}
}
}
function parseSpecialtiesMessage(root) {
var rightspecialtieslist =document.getElementById('rightlistsp');
var especialties = root[0].getElementsByTagName("Description");
var option = null;
option = document.createElement("option");
option.appendChild(document.createTextNode("<-Select Specialties to Remove"));
option.value="Select Specialties to Remove";
rightspecialtieslist.appendChild(option);
for (loop = 0; loop < especialties.length; loop++) {
option = document.createElement("option");
option.appendChild(document.createTextNode(especialties[loop].firstChild.nodeValue));
option.value=especialties[loop].firstChild.nodeValue;
rightspecialtieslist.appendChild(option);
}//for
}
function moveOptions(theSelFrom, theSelTo)
{
var theSelFrom =document.getElementById("leftlist"+listboxid);
var theSelTo =document.getElementById("rightlist"+listboxid);
var selLength = theSelFrom.length;
var seltoLength = theSelTo.length;
var selectedText = new Array();
var selectedValues = new Array();
var selectedCount = 1;
var i;
// Find the selected Options in reverse order
// and delete them from the 'from' Select.
for(i=selLength-1; i>=1; i--)
{
if(theSelFrom.options[i].selected)
{
selectedText[selectedCount] = theSelFrom.options[i].text;
selectedValues[selectedCount] = theSelFrom.options[i].value;
selectedCount++;
}
}
// Add the selected text/values in reverse order.
// This will add the Options to the 'to' Select
// in the same order as they were in the 'from' Select.
var alreadyexist=false;
for(i=selectedCount-1; i>=1; i--)
{
for(var j=1; j < seltoLength; ++j)
{
if(theSelTo.options[j].text == selectedText[i])
{
alreadyexist=true;
break;
}
}
if(!alreadyexist)
{
theSelTo.options[theSelTo.options.length]=new Option(selectedText[i],selectedValues[i],true,true);
}
alreadyexist=false;
}
}
function moveOptionsSpLtoR(theSelFrom, theSelTo)
{
var leftlistbox =document.getElementById("leftlistsp");
var rightlistbox =document.getElementById("rightlistsp");
var LlbLength = leftlistbox.length;
var RlbLength = rightlistbox.length;
var selectedText = new Array();
var selectedValues = new Array();
var selectedCount = 0;
var i;
for(i=LlbLength-1; i>=1; i--)
{
if(leftlistbox.options[i].selected)
{
selectedText[selectedCount] = leftlistbox.options[i].text;
selectedValues[selectedCount] = leftlistbox.options[i].value;
selectedCount++;
}
}
var j=rightlistbox.length;
for(i=0;i<selectedCount; ++i)
{
rightlistbox.options[j]=new Option(selectedText[i],selectedValues[i],true,true);
j=j+1;
}
DoRemoveSp("leftlistsp");
}
function moveOptionsSpRtoL(theSelFrom, theSelTo)
{
var leftlistbox =document.getElementById("leftlistsp");
var rightlistbox =document.getElementById("rightlistsp");
var LlbLength = leftlistbox.length;
var RlbLength = rightlistbox.length;
var selectedText = new Array();
var selectedValues = new Array();
var selectedCount = 0;
var i;
for(i=RlbLength-1; i>=1; i--)
{
if(rightlistbox.options[i].selected)
{
selectedText[selectedCount] = rightlistbox.options[i].text;
selectedValues[selectedCount] = rightlistbox.options[i].value;
selectedCount++;
}
}
if(LlbLength == 0 && (selectedCount>0))
{
var option = null;
option = document.createElement("option");
option.appendChild(document.createTextNode("->Select Specialties to Add"));
option.value="Select Specialties to Add";
leftlistbox.appendChild(option);
dom= findDOM("addsp");
if(dom){
dom.style.display = "inline";
}
}
var j=leftlistbox.length;
for(i=0;i<selectedCount; ++i)
{
leftlistbox.options[j]=new Option(selectedText[i],selectedValues[i],true,true);
j=j+1;
}
DoRemoveSp("rightlistsp");
}
function DoRemoveSp(thislistbox)
{
var selectbox=document.getElementById(thislistbox);
var i;
for(i=selectbox.options.length-1;i>=1;i--)
{
if(selectbox.options[i].selected){
if(selectbox.options[i].style.color != 'graytext')
selectbox.remove(i);
}
}
if(thislistbox == "leftlistsp")
{
if(selectbox.length == 1)
{
selectbox.remove(0);
dom= findDOM("addsp");
if(dom){
dom.style.display = "none";
}
}
}
}
function DoRemoveSpAll(thislistbox)
{
var selectbox=document.getElementById(thislistbox);
var i;
for(i=selectbox.options.length-1;i>=1;i--)
{
selectbox.remove(i);
}
if(selectbox.length == 1)
{
selectbox.remove(0);
dom= findDOM("addsp");
if(dom){
dom.style.display = "none";
}
}
}
function resetspecialtieslistboxes()
{
DoRemoveSpAll("leftlistsp");
DoRemoveSpAll("rightlistsp");
getSpecialties(lidspecialties);
}
function DoRemove()
{
var selectbox=document.getElementById("rightlist"+listboxid);
var i;
for(i=selectbox.options.length-1;i>=1;i--)
{
if(selectbox.options[i].selected){
if(selectbox.options[i].style.color != 'graytext')
selectbox.remove(i);
}
}
}
//////////////////////////////1.1**********GET PBS--END********/////////////////////
///////////////////////form function --2//////////////////////////////////////
function resetPBS(id)
{
if((id == "ugcFormproduct"))
{
var leftcatkeylist =document.getElementById('leftlistp');
var rightcatkeylist =document.getElementById('rightlistp');
}
if((id == "ugcFormservice"))
{
var leftcatkeylist =document.getElementById('leftlists');
var rightcatkeylist =document.getElementById('rightlists');
}
if((id == "ugcFormbrand"))
{
var leftcatkeylist =document.getElementById('leftlistb');
var rightcatkeylist =document.getElementById('rightlistb');
}
for(i=rightcatkeylist.options.length;i>=0;i--)
{
rightcatkeylist.remove(i);
}
for(i=leftcatkeylist.options.length;i>=0;i--)
{
leftcatkeylist.remove(i);
}
getPBSdata(lid,listboxid.toUpperCase());
}
//////////////////////////////1.2**********POST PBS--BEGIN********/////////////////////
var xmlHttp;
var localtermidarray;
var sendpbsxml=false;
function createXML() {
var all = new Array();
var existing = new Array();
var allcount=0;
var existingcount=0;
localtermidarray=new Array();
var options = document.getElementById("rightlist"+listboxid).childNodes;
var option = null;
for(var i = 1; i < options.length; i++) {
option = options[i];
var str=option.value;
if(str.match("/"))
{
existing[existingcount]=str;
existingcount = existingcount + 1;
}
else
{
all[allcount]=str;
allcount = allcount + 1;
}
}
var xml = "<CatKeys>";
if(all.length >= 1)
{
xml = xml + "<All>";
}
var i=0;
for(i=0; i< all.length; ++i)
{
xml = xml + "<Description>" + all[i] + "<\/Description>";
}
if(all.length >= 1)
{
xml = xml + "<\/All>";
}
if(existing.length >= 1)
{
xml = xml + "<Existing>";
}
var i=0;
for(i=0; i < existing.length; ++i)
{
var ecatkey=existing[i];
var ecatkeyarray=ecatkey.split("/");
var ecatkeyarrayamp = ecatkeyarray[0].replace(/&/g,"&amp;");
xml = xml + "<ECatKey>" + "<Description>" + ecatkeyarrayamp + "<\/Description>" +
"<TermId>" + ecatkeyarray[1] + "<\/TermId>" + "<\/ECatKey>";
localtermidarray[i]=ecatkeyarray[1];
}
if(existing.length >= 1)
{
xml = xml + "<\/Existing>";
}
var lines= new Array();
var textareatype =document.getElementById("textarea"+listboxid);//from text area
lines=textareatype.value.split(/\n/);
if(lines.length >= 1)
{
xml=xml+"<FreeText>";
for(var i=0;i <lines.length; ++i)
{
xml = xml + "<Description>" + lines[i] + "<\/Description>";
}
}
if(lines.length >= 1)
{
xml=xml+"<\/FreeText>";
}
xml = xml + "<\/CatKeys>";
var termidArray=new Array();
if(listboxid == 'p') termidArray = productglobaltermidarray;
if(listboxid == 'b') termidArray = brandglobaltermidarray;
if(listboxid == 's') termidArray = serviceglobaltermidarray;
if(!areArraysEqual(localtermidarray, termidArray)||(lines[0] != ''))
sendpbsxml=true;
return xml;
}
function sendcatkeys(prodId, label) {
clickTrackUGC('UGC',prodId,label);
if (typeof ActiveXObject != "undefined") {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
var xml = createXML();
var tempxml= '<CatKeys><All>testing</All></CatKeys>';
if(sendpbsxml){
var spc=document.getElementById('SPC');
var spcuid=document.getElementById('SPCUIDE');
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/UpdateCatKeyServlet?listingid='+lid+'&attributeCode='+listboxid.toUpperCase()+'&sourceType=UGCT&userId=tester'+'&SPC='+spc.value+'&SPCUID='+spcuid.value);
xmlHttp.onreadystatechange = handlePBSStateChange;
xmlHttp.open("POST", url, true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.send(encodeURIComponent(xml));
}
else
{
hideDOM('ugcFormproduct');
hideDOM('ugcFormservice');
hideDOM('ugcFormbrand');
}
}
function handlePBSStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
parsePBSResults();
}
}
}
function parsePBSResults() {
var message = xmlHttp.responseXML.getElementsByTagName("Success")[0];
if(message.childNodes[0].nodeValue == 1)
{
var root = xmlHttp.responseXML;
var words=root.getElementsByTagName("word")[0];
selectString(document.getElementById('textarea'+listboxid), words.childNodes[0].nodeValue);
}
anyattcookie=readCookie('anyattributechanged');
if(message.childNodes[0].nodeValue == 0 )
{
hideDOM('ugcFormproduct');
hideDOM('ugcFormservice');
hideDOM('ugcFormbrand');
hideDOM('beforeattribchange');
if((!anyattcookie)){
document.cookie ='anyattributechanged=yes';
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
else
{
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
if(anyattcookie){
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
//////////////////////////////1.2**********POST PBS--END********/////////////////////
//*******************************************************************************//
////2.1**********GET ?/POST Hours of Operation--BEGIN**getting data from webservice///
function repeatmontofri()
{
var fday='';
var tday='';
for(var i=0; i < 5; ++i)
{
var fromday =document.getElementById("fday"+(i+1));//from combo box
if(fromday.value != '')
{
fday=fromday.value;
break;
}
}
for(var i=0; i < 5; ++i)
{
var today =document.getElementById("tday"+(i+1));//to combo box
if(today.value != '')
{
tday=today.value;
break;
}
}
if(tday !='')
{
for(var i=0; i < 5; ++i)
{
var today =document.getElementById("tday"+(i+1));//to combo box
today.value=tday;
}
}
if(fday !='')
{
for(var i=0; i < 5; ++i)
{
var fromday =document.getElementById("fday"+(i+1));//to combo box
fromday.value=fday;
}
}
}
function resetHopdata(lid)
{
for(var i=0; i < 7; ++i)
{
var fromday =document.getElementById("fday"+(i+1));//from combo box
var today =document.getElementById("tday"+(i+1));//to combo box
fromday[0].selected = true;
today[0].selected = true;
}//for(var i=0; i < 7; ++i)
getHopdata(lid);
////////////////
}//getHopdata
/////////////////////////////////////////
var globalhopfromarray;
var globalhoptoarray;
function getHopdata(lid)
{
if (typeof ActiveXObject != "undefined") {
oXmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
oXmlHttp = new XMLHttpRequest();
}
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent('http://'+hopdatServ+'/axis2/services/ADPortalWebService/BPDataReq?ListingId='+lid+'&SourceId=100');
oXmlHttp.open("GET", url, false);
oXmlHttp.setRequestHeader("Content-Type", "text/xml");
oXmlHttp.send(null);
var root = oXmlHttp.responseXML;
var browsertype=navigator.appName;
var subSection = browsertype.substring(3,0);
var schedules=null;
if(subSection == "Mic")
{
schedules=root.getElementsByTagName("SCHEDULE");
} else
{
schedules=root.getElementsByTagName("SCHEDULE");
}
//var schedules =root.getElementsByTagName("s:SCHEDULE");
//////////////
for(var i=0; i < schedules.length; ++i)
{
var fromday =document.getElementById("fday"+(i+1));//from combo box
var today =document.getElementById("tday"+(i+1));//to combo box
if(schedules[i].childNodes.length >=0)
{
for(var j=0; j<schedules[i].childNodes.length;++j)
{
if(schedules[i].childNodes[j].hasChildNodes())
{
var time=null;
if(subSection == "Mic")
{
time=schedules[i].childNodes[j].firstChild.text;
}
else
{
time=schedules[i].childNodes[j].firstChild.textContent;
}
if(j == 2)
{
for(var k=0; k < fromday.length ; ++k)
{
if((fromday[k].text) == (time))
{
fromday[k].selected = true;
}
}
}
if(j == 3)
{
for(var k=0; k < today.length ; ++k)
{
if((today[k].text) == (time))
{
today[k].selected = true;
}
}
}
}//if(schedules[i].childNodes[j].hasChildNodes())//hours available for the given day
else //empty xml node//hours not available for that given day, then choose select
{
fromday[0].selected = true;
today[0].selected = true;
}
}//for(var j=0; j<schedules[i].childNodes.length;++j)
}//if(schedules[i].childNodes.length >=0)
}//for(var i=0; i < schedules.length; ++i)
globalhopfromarray=new Array();
globalhoptoarray=new Array();
for (var loop = 0; loop < 7; ++loop)
{
var fromday =document.getElementById("fday"+(loop+1));//from combo box
globalhopfromarray[loop]=fromday.value;
var today =document.getElementById("tday"+(loop+1));//to combo box
globalhoptoarray[loop]=today.value;
}
}//getHopdata
//24hours/ closed, if one selected, making the other select box option changes
function fromvalueSelected(no)
{
var fromtime=document.getElementById("fday"+no);
//Closed Open24hrs
var totime=document.getElementById("tday"+no);
if(fromtime.value == 'Closed' || fromtime.value == 'Open24hrs')
{
for(i=0;i<totime.length;++i)
{
if(totime[i].value==fromtime.value)
{
totime[0].selected=true;
totime.disabled=true;
}
}
}
else
{
totime.disabled=false;
}
}
function tovalueSelected(no)
{
var totime=document.getElementById("tday"+no);
//Closed Open24hrs
var fromtime=document.getElementById("fday"+no);
if(totime.value == 'Closed' || totime.value == 'Open24hrs')
{
for(i=0;i<fromtime.length;++i)
{
if(fromtime[i].value==totime.value)
{
fromtime[0].selected=true;
fromtime.disabled=true;
}
}
}
else
{
fromtime.disabled=false;
}
}
////2.1**********GET ?/POST Hours of Operation--END**getting data from webservice///
//.....................................................................................//
////2.2**********POST send Hours of Operation--BEGIN**********************************///
var localhopfromarray;
var localhoptoarray;
var sendhopxml=false;
function createhopXML() {
var days = new Array(7);
days[0] ="Mon";
days[1] ="Tue";
days[2] ="Wed";
days[3] ="Thu";
days[4] ="Fri";
days[5] ="Sat";
days[6] ="Sun";
// var xml = "<All><Description><\/Description><Description><\/Description><Description><\/Description><\/All>";
//Wed 11:00 AM-05:00 PM
var xml = "<All><Description>";
localhopfromarray=new Array();
localhoptoarray=new Array();
for (var loop = 0; loop < 7; ++loop)
{
var fromday =document.getElementById("fday"+(loop+1));//from combo box
localhopfromarray[loop]=fromday.value;
var today =document.getElementById("tday"+(loop+1));//to combo box
localhoptoarray[loop]=today.value;
}
for (var loop = 0; loop < 7; ++loop)
{
var fromday =document.getElementById("fday"+(loop+1));//from combo box
var today =document.getElementById("tday"+(loop+1));//to combo box
if(fromday.value == '' && today.value == '')//no hours exist for that given day
{
}
else//hours exist for that given day
{
if(loop == 6)
{
if((fromday.value == 'Closed')||(today.value == 'Closed')||(fromday.value == 'Open24hrs')||(today.value == 'Open24hrs'))
{
xml = xml + days[loop]+" "+ fromday.value+today.value;
}
else
{
xml = xml + days[loop]+" "+ fromday.value +"-"+today.value;
}
}
else
{
if((fromday.value == 'Closed')||(today.value == 'Closed')||(fromday.value == 'Open24hrs')||(today.value == 'Open24hrs'))
{
xml = xml + days[loop]+" "+ fromday.value+today.value+";";
}
else
{
xml = xml + days[loop]+" "+ fromday.value +"-"+today.value+";";
}
}
}
}
//xml=xml+accumlate; //pending the
xml=xml+"<\/Description><\/All>";
if(!areArraysEqual(localhoptoarray, globalhoptoarray)||(!areArraysEqual(localhopfromarray, globalhopfromarray)))
sendhopxml=true;
return(xml);
}
function sendhop(lid, prodId,label) {
////////////////////
clickTrackUGC('UGC',prodId,label);
if (typeof ActiveXObject != "undefined") {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
////////////////////
var xml = createhopXML();
if(sendhopxml)
{
var spc=document.getElementById('SPC');
var spcuid=document.getElementById('SPCUIDE');
// var xml="<All><Description>Mon-Sun: 24 Hour Service</Description></All>"
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/UpdateBPServlet?listingid='+lid+'&attributeCode=Hours+of+Operation&sourceType=UGCUT&userId=tester'+'&SPC='+spc.value+'&SPCUID='+spcuid.value);
//var url = 'http://nbttest1.superpages.com:9080/ugcwiki/UpdateBPServlet?listingid=0000255412&attributeCode=Hours of Operation&sourceType=UGCUT&userId=tester';
xmlHttp.open("POST", url, true);
xmlHttp.onreadystatechange = handlehopStateChange;
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
xmlHttp.send(xml);
}
}
function handlehopStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
parsehopResults();
}
}
}
function parsehopResults() {
var message = xmlHttp.responseXML.getElementsByTagName("Success")[0];
anyattcookie=readCookie('anyattributechanged');
if(message.childNodes[0].nodeValue == 0 )
{
//responseDiv.removeChild(responseDiv.childNodes[0]);
hideDOM('ugcFormhoursofoperation');
hideDOM('beforeattribchange');
if((!anyattcookie)){
document.cookie ='anyattributechanged=yes';
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
else
{
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
if(anyattcookie){
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
////2.2**********POST send Hours of Operation--END**********************************///
//**********************************************************************************//
////3**********POST send Payment--BEGIN*********************************************///
var globalpaymentarray;
function createPaymentXML() {
globalpaymentarray=new Array();
// var xml = "<All><Description><\/Description><Description><\/Description><Description><\/Description><\/All>";
var xml = "<All>";
var j=0;
for(var i=0; i<15;++i)
{
var paymenttype =document.getElementById("payment"+i);//from check box
if(paymenttype.checked)
{
globalpaymentarray[j]=paymenttype.value;
j=j+1;
xml = xml + "<Description>" + paymenttype.value + "<\/Description>";
}
}
xml=xml+"<\/All>";
return xml;
}
function sendpayment(paymenttypes,lid, prodId, label)
{
var paymenttypes= paymenttypes.substr(1,(paymenttypes.length-2));
paymenttypes= paymenttypes.replace('&#039;', "'");
var paymenttypesarray =new Array();
paymenttypesarray=paymenttypes.split(",");
clickTrackUGC('UGC',prodId,label);
if (typeof ActiveXObject != "undefined") {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
var xml = createPaymentXML();
for(var i=1;i<globalpaymentarray.length;++i)
globalpaymentarray[i]=" "+globalpaymentarray[i];
if(!areArraysEqual(globalpaymentarray.sort(),paymenttypesarray))
{
var spc=document.getElementById('SPC');
var spcuid=document.getElementById('SPCUIDE');
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/UpdateBPServlet?listingid='+lid+'&attributeCode=Payment+Options&sourceType=UGCUT&userId=tester'+'&SPC='+spc.value+'&SPCUID='+spcuid.value);
// var url = 'http://nbttest1.superpages.com:9080/ugcwiki/UpdateBPServlet?listingid=0000253383&attributeCode=Payment Options&sourceType=UGCUT&userId=tester';
xmlHttp.open("POST", url, true);
xmlHttp.onreadystatechange = handlePaymentStateChange;
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
xmlHttp.send(encodeURIComponent(xml));
}
else
{
hideDOM('ugcFormpaymentoptions');
}
}
function handlePaymentStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
parsePaymentResults();
}
}
}
function parsePaymentResults() {
var message = xmlHttp.responseXML.getElementsByTagName("Success")[0];
anyattcookie=readCookie('anyattributechanged');
if(message.childNodes[0].nodeValue == 0 )
{
hideDOM('ugcFormpaymentoptions');
hideDOM('beforeattribchange');
if((!anyattcookie)){
document.cookie ='anyattributechanged=yes';
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
else
{
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
if(anyattcookie){
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
////3**********POST send Payment--END*********************************************///
//*********************************************************************************//
////4**********POST send Specialities--BEGIN*********************************************///
var sendspexml=false;
function createSpecialitiesXML() {
var xml = "<All>";
var specialty =document.getElementById("specialtyta");
var specialities= new Array();
var k=0;
var n = specialty.value.split(/\n/).length;
var lines= new Array();
lines=specialty.value.split(/\n/);
for(var i=0;i <lines.length; ++i)
{
if(lines[i] != '')
xml = xml + "<Description>" + lines[i] + "<\/Description>";
}
var deletedspecialties =document.getElementById("leftlistsp");
var options = document.getElementById("leftlistsp").childNodes;
for(var i = 1; i < options.length; i++) {
option = options[i];
var str=option.value;
xml = xml + "<Description>" + str + "<\/Description>";
}
xml=xml+"<\/All>";
if((lines[0]!='')||(options.length>1))
sendspexml=true;
return xml;
}
function sendspecialities(lid, prodId, label) {
clickTrackUGC('UGC',prodId,label);
if (typeof ActiveXObject != "undefined") {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
var xml = createSpecialitiesXML();
if(sendspexml)
{
var spc=document.getElementById('SPC');
var spcuid=document.getElementById('SPCUIDE');
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/UpdateBPServlet?listingid='+lid+'&attributeCode=Specialties&sourceType=UGCUT&userId=tester'+'&SPC='+spc.value+'&SPCUID='+spcuid.value);
xmlHttp.open("POST", url, true);
xmlHttp.onreadystatechange = handleSpecialitiesStateChange;
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
xmlHttp.send(encodeURIComponent(xml));
}
else
{
hideDOM('ugcFormspecialties');
}
}
function handleSpecialitiesStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
parseSpecialitiesResults();
}
}
}
function parseSpecialitiesResults() {
var message = xmlHttp.responseXML.getElementsByTagName("Success")[0];
anyattcookie=readCookie('anyattributechanged');
if(message.childNodes[0].nodeValue == 1)
{
var root = xmlHttp.responseXML;
var words=root.getElementsByTagName("word")[0];
selectString(document.getElementById('specialty'), words.childNodes[0].nodeValue);
}
if(message.childNodes[0].nodeValue == 0 )
{
hideDOM('ugcFormspecialties');
hideDOM('beforeattribchange');
if((!anyattcookie)){
document.cookie ='anyattributechanged=yes';
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
else
{
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
if(anyattcookie){
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
////4**********POST send Specialities--END*********************************************///
//***************************************************************************************//
////5**********POST send Customer served--BEGIN*********************************************///
var globalCSarray;
function createCustomerServedXML() {
globalCSarray = new Array();
var j=0;
var xml = "<All>";
for(var i=0; i<3;++i)
{
var customerservedtype =document.getElementById("customerserved"+i);//from check box
if(customerservedtype.checked)
{
globalCSarray[j]=customerservedtype.value;
j=j+1;
xml = xml + "<Description>" + customerservedtype.value + "<\/Description>";
}
}
xml=xml+"<\/All>";
return xml;
}
function sendcustomersserved(existingCSitems, lid, prodId, label) {
var CSarray=new Array();
CSarray=existingCSitems.split(",");
clickTrackUGC('UGC',prodId,label);
if (typeof ActiveXObject != "undefined") {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
var xml = createCustomerServedXML();
for(var i=1;i<globalCSarray.length;++i)
globalCSarray[i]=" "+globalCSarray[i];
if(!areArraysEqual(CSarray,globalCSarray.sort()))
{
var spc=document.getElementById('SPC');
var spcuid=document.getElementById('SPCUIDE');
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/UpdateBPServlet?listingid='+lid+'&attributeCode=Customers+Served&sourceType=UGCUT&userId=tester'+'&SPC='+spc.value+'&SPCUID='+spcuid.value);
xmlHttp.open("POST", url, true);
xmlHttp.onreadystatechange = handleCustomerServedStateChange;
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
xmlHttp.send(encodeURIComponent(xml));
}
else
{
hideDOM("ugcFormcustomersserved");
}
}
function handleCustomerServedStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
parseCustomerServedResults();
}
}
}
function parseCustomerServedResults() {
var message = xmlHttp.responseXML.getElementsByTagName("Success")[0];
anyattcookie=readCookie('anyattributechanged');
if(message.childNodes[0].nodeValue == 0 )
{
hideDOM('ugcFormcustomersserved');
hideDOM('beforeattribchange');
if((!anyattcookie)){
document.cookie ='anyattributechanged=yes';
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
else
{
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
if(anyattcookie){
hideDOM('beforeattribchange');
showugcDOM('afterattribchange');
}
}
////5**********POST send Customer served--END*********************************************///
//****************************************************************************************///
//*********************************************************************************///
////9**********POST send changed PSFTEW-rolodex forms--BEGIN*****************************************///
//////////P-primary, S-secondary, F-fax, T-tollfree, E-email, W-website/////////////////////////////////
function check(name)
{
}
/* call this method on clicking no button( photoupload)
(want to upload more photos(yes/no)*/
var emailxmlHttp;
var eMyDirURL;
function checkloginandcallabook()
{
var mydirurl=document.getElementById("mydirurl");
var mydirurlp=mydirurl.value;
eMyDirURL=mydirurlp;
anyLIFcheckboxcookiechanged=readCookie('anyLIFcheckboxcookiechanged');
anyLIFcookie=readCookie('anyLIFcookiechanged');
if(anyLIFcookie || anyLIFcheckboxcookiechanged){//conflict between rolodex forms and check boxes, thats why anyLIFcheckboxcookiechanged used
sendemailtoLIG();
// parsePSFTWEResults(mydirurl);
// xmlHttp.send(encodeURIComponent(poststr1));
}
var poststr="UID=UID1188409509-jt1-15512561-7961";
if (typeof ActiveXObject != "undefined") {
emailxmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
emailxmlHttp = new XMLHttpRequest();
}
//var url='http://nbttest1.superpages.com:9080/ugcwiki/SendEmail?UID=';
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/GetDataServlet?UID=');
var SPCUIDE=document.getElementById('SPCUIDE');
var SPC=document.getElementById('SPC');
if(SPCUIDE.value)
{
url=url+SPCUIDE.value;
//var url='http://www.superpages.com/cgi-bin/formmail.pl?'+poststr1;
emailxmlHttp.onreadystatechange = handleemailStateChange;
//emailxmlHttp.open("POST", url, true);
emailxmlHttp.open("GET", url, true);
// emailxmlHttp.send(poststr);
emailxmlHttp.send(null);
}
else
{
var mydirurl=document.getElementById('mydirurl');
document.location.href=mydirurl.value;
}
}
function handleemailStateChange() {
if(emailxmlHttp.readyState == 4) {
if(emailxmlHttp.status == 200) {
parseemailResults();
}
}
}
function parseemailResults() {
var toemail = emailxmlHttp.responseXML.getElementsByTagName("emailId")[0];
// if(message.childNodes[0].nodeValue == 0 )
///document.location.href=eMyDirURL;
var SPC=document.getElementById('SPC');
var SPCUIDE=document.getElementById('SPCUIDE');
//var eurl="http://nbttest1.superpages.com:9080/ugcwiki/UserServlet?sessionId="+SPC.value+"&userId="+SPCUIDE.value+"&confirmType=photo&photoFlag=yes";
var eurl = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/UserServlet?sessionId='+SPC.value+'&userId='+SPCUIDE.value+'&confirmType=photo&photoFlag=yes');
//document.location.href=eurl;
sendemailtouserforphotos(eurl,toemail.childNodes[0].nodeValue);
}
var xmlHttpUM;//UM-user email
var toEmail;
function sendemailtouserforphotos(url,toEmailp) {
toEmail=toEmailp;
if (typeof ActiveXObject != "undefined") {
xmlHttpUM = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttpUM = new XMLHttpRequest();
}
//var url = 'http://nbttest1.superpages.com:9080/ugcwiki/UpdateCatKeyServlet?listingid='+lid+'&attributeCode='+listboxid.toUpperCase()+'&sourceType=UGCT&userId=tester';
//var url="http://nbttest1.superpages.com:9080/ugcwiki/UserServlet?sessionId="+SPC.value+"&userId="+SPCUIDE.value+"&confirmType=photo&photoFlag=yes";
xmlHttpUM.open("GET", url, true);
xmlHttpUM.onreadystatechange = handleEmailtouserforphotosStateChange;
xmlHttpUM.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttpUM.send(null);
}
function handleEmailtouserforphotosStateChange() {
if(xmlHttpUM.readyState == 4) {
if(xmlHttpUM.status == 200) {
parseEmailtouserforphotosResults();
}
}
}
function parseEmailtouserforphotosResults() {
//var toemail=document.getElementById('useremail');
//toemail.innerHTML=toEmail;
hideObject('picugcForm2');
showugcDOM('picugcConfirm');
}
//////////////////////////////////////////
/* on confirm-all button*/
var xmlHttp;
var mydirurl;
function sendemailtoLIGandcallabookfromlistingoutofbusiness(mydirurlp)
{
anyLIFcookie=readCookie('anyLIFcookiechanged');
anyLIFcheckboxcookiechanged=readCookie('anyLIFcheckboxcookiechanged');
if(anyLIFcookie || anyLIFcheckboxcookiechanged){//conflict between rolodex forms and check boxes, thats why anyLIFcheckboxcookiechanged used
//alert("in if");
sendemailtoLIG();
parsePSFTWEResults(mydirurlp);
// xmlHttp.send(encodeURIComponent(poststr1));
}
}
function sendemailtoLIGandcallabook(mydirurlp)
{
//alert("sendemailtoLIGandcallabook"+mydirurlp);
hideObject('btn_ugcdone');
showugcDOM('btn_ugcwait');
mydirurl=mydirurlp;
anyLIFcookie=readCookie('anyLIFcookiechanged');
anyLIFcheckboxcookiechanged=readCookie('anyLIFcheckboxcookiechanged');
//var checkboxpitem=document.getElementById('chphone1');
//alert("v$$"+document.getElementById('chphone1').value);
//alert("c$$"+document.getElementById('chphone1').checked);
if(globalphonecheckbox == "yes")
{
globalphonecheckbox='no';
for(var i=1;i<=4;++i)
{
addcheckboxitemstoxcookie('chphone'+i);
}//for
}
if(globaladdresscheckbox == "yes")
{
globaladdresscheckbox='no';
for(var i=1;i<=2;++i)
{
addcheckboxitemstoxcookie('chaddress'+i);
}//for
}
addcheckboxitemstoxcookie('chbusiness1');
if(anyLIFcookie || anyLIFcheckboxcookiechanged){//conflict between rolodex forms and check boxes, thats why anyLIFcheckboxcookiechanged used
//alert("in if");
sendemailtoLIG();
parsePSFTWEResults(mydirurl);
// xmlHttp.send(encodeURIComponent(poststr1));
}
}
function findbtolistingsurl(url)
{
if(url.match("listings.jsp"))
{//alert("has listing");
document.location.href=url;
}else
{
//alert(readCookie("btolisitngsurl"));
document.location.href=readCookie("btolisitngsurl");
}
}
function callredirectLink(link,url)
{
document.cookie ='btolisitngsurl='+url;
document.location.href=link;
}
/* on blog add*/
function callLIGredirectLink(link)
{
anyLIFcookie=readCookie('anyLIFcookiechanged');
anyLIFcheckboxcookiechanged=readCookie('anyLIFcheckboxcookiechanged');
if(anyLIFcookie || anyLIFcheckboxcookiechanged){ //mostly this wont happen
sendemailtoLIG();
}
document.location.href=link;
}
function sendemailtoLIG()
{
//alert("sendemailtoLIG");
var sprec=document.getElementById('sprecipient');
var lid=document.getElementById('ugclid');
var info=document.getElementById('info');
var sub=document.getElementById('subject');
var poststr1 = "";
//alert("dfg");
////////////////////////////
///////////////////////////
// poststr1=poststr1+"&LID="+lid.value+"&info="+infov+"&subject="+sub.value;
var cookies = document.cookie.split(";");
var cookiess = document.cookie.replace(/ /g,"").split(";");
//cookies.replace(/\&/g,"%26");
for (var i =(cookies.length -1); i >=0; i--){
//w cookiePair = cookies[i].split("=");
//if(cookies[i].match("x="))alert("x cookie="+cookies[i]);
if((cookies[i].match("Suggested%20Category%20"))||(cookies[i].match("Delete%20Categories:+"))||(cookies[i].match("x=")))
{
//if(!(poststr1.match("x=")))
//alert("x cookie");
poststr1=poststr1+"&"+cookies[i];
}
if(cookiess[i].match("ugcForm")){
if(cookiess[i].match("ugcFormstreet") ){
var str=cookiess[i].substring(14);
}
else if(cookiess[i].match("ugcFormcity"))
{
var str=cookiess[i].substring(12);
}
else if(cookiess[i].match("ugcFormstate"))
{
var str=cookiess[i].substring(13);
}
else if(cookiess[i].match("ugcFormzip"))
{
var str=cookiess[i].substring(11);
}
else
{
var str=cookiess[i].substring(11);//phoneFTEW
}
//alert("##"+str);
var cookiearray = str.split("suggested");
// alert("&"+cookiearray[0]+" suggested %3D"+cookiearray[1]);
poststr1=poststr1+"&"+cookiearray[0]+" suggested %3D"+cookiearray[1];
}
}
//alert(poststr1);
for (var i = 0; i < cookies.length; i++){
if((cookies[i].match("Suggested%20Category%20"))||(cookies[i].match("Delete%20Categories:+")))
{
delete_cookie(cookies[i]);
}
if(cookies[i].match("ugcForm"))
delete_cookie(cookies[i]);
if(cookies[i].match("x"))
delete_cookie(cookies[i]);
}
//var poststr = "sprecipient="+document.getElementById("sprecipient").value+"&ugcFormTF"+formtype+"=" + encodeURI( document.getElementById("ugcFormTF"+formtype).value );
if (typeof ActiveXObject != "undefined") {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
var regExp = /\s+/g;
var sub= sub.value;
var subv = sub.replace(regExp,'+');
var postst = poststr1.replace(regExp,'+');
var rplce1 = /\+Suggested/g;
var rplce2 = /\+Delete/g;
var poststt = postst.replace(rplce1,'Suggested').replace(rplce2,'Delete');
var varremote_add = remote_add.replace(regExp,'+');
var varhttp_user = http_user.replace(regExp,'+');
var url = hostServ+'/bp/xmlproxy?url=' + formmail + encodeURIComponent('?ugc=1&sprecipient=' + sprecipient + '&LID=' + lid.value + '&info=' + info.value + '&subject=' + subv + poststt + '&' + varremote_add + '&' + varhttp_user);
// alert(url);
xmlHttp.open("GET", url, true);
//xmlHttp.onreadystatechange = handlePSFTWEStateChange;
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
//alert(url);
xmlHttp.send(null);
delete_cookie("anyattributechanged");
delete_cookie("anyLIFcookiechanged");
delete_cookie("anyLIFcheckboxcookiechanged");
}
function handlePSFTWEStateChange() { //not using this method anymore
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
parsePSFTWEResults();
}
}
}
function parsePSFTWEResults()
{
}
/* This gets called from sendemailtoLIGandcallabook(on confirm-all button)*/
function parsePSFTWEResults(mydirurl) {
if(g_businesschboxchecked)
{
document.getElementById('chbusiness1').checked=false;
}
document.location.href=mydirurl;
}
////10*********GE
//onBlur="onBlurfun('1')"
////6**********GET checking photo upload status--BEGIN***********************************///
function clearphotouploadtextfields()
{
document.getElementById("filetfb").outerHTML = "<input size='40' type='file' id='filetfb' name='myFile' value='Browse' >";
document.getElementById("filetfb").value="";
document.getElementById("ptitle").value="";
}
/* before submitting photoupload form, set hidden field(varRand) of a photoupload form with a random value
and assign that randomvalue to a global variable(grandno) and access that global variable in
checkphotouploadstatus function*/
function sethiddenrand()
{
var rand=Math.floor(Math.random()*99999999);
window.document.myForm.varRand.value=rand;
grandno=rand;
}
var photoreq=null;
function checkphotouploadstatus()
{
hideDOM("picugcForm1");//upload photo form div
showugcDOM("uploadanimation");//this div has the gif with the moving arrow in circular motion
window.setTimeout('checkphotouploadstatusinloop();', 2000);//calling checkphotouploadstatusinloop function after 2secs
}
function checkphotouploadstatusinloop()
{
if (typeof ActiveXObject != "undefined") {
photoreq = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
photoreq = new XMLHttpRequest();
}
//use escape on grandno so that trailing zeros wont chopped off from the value
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/PhotosServlet?varRand='+escape(grandno));
photoreq.onreadystatechange = photoprocessStateChange;
photoreq.open("GET", url, true);
photoreq.send(null);
}
function photoprocessStateChange()
{
if (photoreq.readyState == 4)
{
if (photoreq.status == 200) // OK response
{
var xml = photoreq.responseXML;
var statuscode= xml.getElementsByTagName("status")[0];
if(statuscode.childNodes[0].nodeValue == 'n'){ //'n'-not done yet
window.setTimeout("checkphotouploadstatusinloop();", 100);
}
}
//c- cant be done h-huge y-done
if((statuscode.childNodes[0].nodeValue != 'n')&&(statuscode.childNodes[0].nodeValue != 'c')&&(statuscode.childNodes[0].nodeValue != 'h')&&(statuscode.childNodes[0].nodeValue != 'y'))
{
var innerhtmlstr="your file again.";//other than 'p','y','c','h'--if exception happened on serverside
//'n'-not done yet
var inhtmldiv=document.getElementById('photouploadwarnmsg');//photouploadwarnmsg is a span on picugcForm3
inhtmldiv.innerHTML =innerhtmlstr;
hideDOM("uploadanimation");
hideDOM("picugcForm1");//photouloadform
showugcDOM("picugcForm3");
}
if(statuscode.childNodes[0].nodeValue == 'p'){//profanity
var innerhtmlstr="a file without profanity in the title.";
var inhtmldiv=document.getElementById('photouploadwarnmsg');//photouploadwarnmsg is a span on picugcForm3
inhtmldiv.innerHTML =innerhtmlstr;
hideDOM("uploadanimation");
hideDOM("picugcForm1");//photouloadform
showugcDOM("picugcForm3");//commn photo error form
}
if(statuscode.childNodes[0].nodeValue == 'y'){ //uploaded successfully
hideDOM("uploadanimation");
hideDOM("picugcForm1");//photouloadform
showugcDOM("picugcForm2");//success form
}
if(statuscode.childNodes[0].nodeValue == 'c'){ //not a gif or jpeg
var innerhtmlstr="a JPEG or a GIF file.";
var inhtmldiv=document.getElementById('photouploadwarnmsg');//photouploadwarnmsg is a span on picugcForm3
inhtmldiv.innerHTML =innerhtmlstr;
hideDOM("uploadanimation");
hideDOM("picugcForm1");//photouloadform
showugcDOM("picugcForm3"); //commn photo error form
}
if(statuscode.childNodes[0].nodeValue == 'h'){//file size is huge
var innerhtmlstr="a smaller size file.";
var inhtmldiv=document.getElementById('photouploadwarnmsg');//photouploadwarnmsg is a span on picugcForm3
inhtmldiv.innerHTML =innerhtmlstr;
hideDOM("uploadanimation");
hideDOM("picugcForm1");//photouloadform
showugcDOM("picugcForm3");//commn photo error form
}
}
}
////6**********GET checking photo upload status--END***********************************///
//*************************************************************************************///
////7**********GET get photos and show--BEGIN******************************************///
var browserName=navigator.appName; // Get the Browser Name
if(browserName=="Microsoft Internet Explorer") // For IE
{
window.onload=getphotosonpageload; // Call getphotosonpageload function in IE
}
else
{
if (document.addEventListener) // For Firefox
{
document.addEventListener("DOMContentLoaded", getphotosonpageload, false); // Call getphotosonpageload function in Firefox
}
}
var images = new Array();
var largeimages = new Array();
var imageslink;// = new Array();
var photodownloadreq;
var titles;
var nicknames;
var photoids;
var userids;
var photos;
var imagesfordimentions=new Array();
var photodownloadreqonload;
function getphotosonpageload()
{
//alert("getphotosonpageload");
var lid=lidforpageload;
listingno=lid;
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/GetPhotoServlet?listingId='+lid);
if (typeof ActiveXObject != "undefined") {
photodownloadreqonload = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
photodownloadreqonload = new XMLHttpRequest();
}
photodownloadreqonload.onreadystatechange = callbackdownloadimagesforpageload;
photodownloadreqonload.open("GET", url, true);
photodownloadreqonload.send(null);
}
function callbackdownloadimagesforpageload() {
if (photodownloadreqonload.readyState == 4) {
if (photodownloadreqonload.status == 200) {
parsedownloadimagesforpageload();
}
}
}
var innerhtmlstrforphotos="";
var photosforonload="";
function parsedownloadimagesforpageload() {
photosforonload = photodownloadreqonload.responseXML.getElementsByTagName("photoURL");
//photosforonload=photodownloadreqonload.responseXML.getElementsByTagName("photoURL");
//var root=photodownloadreqonload.responseXML;
//var responseNodes=root.getElementsByTagName("photoURL");
//var longterms= root.getElementsByTagName("longTerm");
//alert("res="+responseNodes);
//alert(photosforonload.length);
var photosLength=0;
if(photosforonload.length <=3)
{
photosLength=photosforonload.length;
}
else
{
photosLength=3;
}
//alert(photosLength);
/*if(photosLength < 3)
{
var uploaddiv="picugcForm1";
var addphoto="http://img.superpages.com/images-yp/sp/images/addaphoto.gif";
innerhtmlstrforphotos="<a href='javascript:;' onclick='clearphotouploadtextfields();hideallids(); showugcDOM(\""+uploaddiv+"\"); return true;'><img src="+addphoto+" id=loadpic"+(0)+" width=72 height=54 alt=Add Photo "+(0)+"/></a>";
}*/
for(var i=0;i<photosLength;++i)
{
var str = photosforonload[i].childNodes[0].nodeValue;
str = str.substring(36);
str= str.replace("images", "thumb");
str = imServ+str;
innerhtmlstrforphotos=innerhtmlstrforphotos+"<img src="+str+" id=loadpic"+(i+1)+" width=73 height=59 alt=Photo "+(i+1)+"/>";
//innerhtmlstrforphotos=innerhtmlstrforphotos+"<a href='javascript:;' id=loadpic"+(i+1)+" onclick='setPhotoNoForShowLargePicOnload(\""+(i+1)+"\");P7_Snap(\"loadpic"+i+1+"\",\"viewphotos\",-100,200);hideallids(); showugcDOMlid(\"viewphotos\",\""+lidforpageload+"\"); return true;'><img src="+str+" id=loadpic"+(i+1)+" width=72 height=54 alt=Photo "+(i+1)+"/></a>";
}
if(photosforonload.length > 0)
{
dom=findDOM('photosviewallid');
if(dom)
{
dom.style.display="inline";
}
}
dom = findDOM('photoCount');
if (dom){
dom.innerHTML="";
dom.innerHTML = photosforonload.length;
}
displayfirstthree('OLPhotos');
}
var photoNoForShowLargePicOnload=0;
function setPhotoNoForShowLargePicOnload(picno)
{
photoNoForShowLargePicOnload=picno;
}
function displayfirstthree(id)
{
var b = navigator.appName;
if (b == "Netscape")
{
dom = findDOM('photoCount');
if (dom){
dom.innerHTML="";
dom.innerHTML = photosforonload.length;
}
}
dom = findDOM('OLPhotos');
if (dom){
//alert("dom");
dom.innerHTML="";
dom.innerHTML = innerhtmlstrforphotos;
}
}
///////////////////////////////////////////////
///////////////////////////////////////////////
function getphotos(lid)
{
listingno=lid;
images = new Array();
largeimages = new Array();
//var url='http://nbttest1.superpages.com:9080/ugcwiki/GetPhotoServlet?listingId=2434';
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/GetPhotoServlet?listingId='+lid);
//var url='http://nbttest1.superpages.com:9080/ugcwiki/GetPhotoServlet?listingId='+lid;
if (typeof ActiveXObject != "undefined") {
photodownloadreq = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
photodownloadreq = new XMLHttpRequest();
}
photodownloadreq.onreadystatechange = callbackdownloadimages;
photodownloadreq.open("GET", url, true);
photodownloadreq.send(null);
}
function callbackdownloadimages() {
if (photodownloadreq.readyState == 4) {
if (photodownloadreq.status == 200) {
parsedownloadimages();
}
}
}
function parsedownloadimages() {
photos = photodownloadreq.responseXML.getElementsByTagName("photoURL");
titles = photodownloadreq.responseXML.getElementsByTagName("title");
nicknames = photodownloadreq.responseXML.getElementsByTagName("nickname");
photoids= photodownloadreq.responseXML.getElementsByTagName("photoId");
userids= photodownloadreq.responseXML.getElementsByTagName("userId");
emailids=photodownloadreq.responseXML.getElementsByTagName("emailId");
for(var i=0;i<photos.length;++i)
{
var str = photos[i].childNodes[0].nodeValue;
var largestr=photos[i].childNodes[0].nodeValue;
str = str.substring(36);
largestr=largestr.substring(36);
str= str.replace("images", "thumb");
str = imServ+str;
largestr=imServ+largestr;
images[i]=str;
largeimages[i]=largestr;
imagesfordimentions[i]=new Image();
imagesfordimentions[i].src=largestr;
}
imageslink = new Array(imgLoc+'addYourPhoto.gif');
displayphotos();
}
var totalphotos;
var begin;
var end;
var balance;
function displayphotos()
{
if(begin == undefined || begin == 0)
{
begin=1;
}
/*new
if(balance == 0)
{
end=end-1;
}
*/
//begin=1;
totalphotos=0;
totalphotos=images.length;
dom = findDOM('prev');
if (dom){
dom.style.display = "none"; //inline
}
if(totalphotos == 0)
{
//Add link holder
var linkdiv=document.getElementById('p'+1);
linkdiv.style.visibility = "visible";
//linkdiv.style.display = "show";
var imageholder = document.getElementById('im'+1);
//imageholder.style.visibility = "visible";
//imageholder.style.display = "show";
//imageholder.src = images[0];
imageholder.src = imageslink[0];
//linkdiv.innerHTML = "<a href='#'>addphoto</a>";//objImage;
//j=j+1;
dom = findDOM('p'+1);
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "inline"; //inline
}
}
else if(totalphotos <=3)
{
var j=1;
//for(var i=1;i<=totalphotos;++i)
for(var i=1;i<=totalphotos;++i)
{
//document.getElementById('p'+j+'m'+j).innerHTML = '<input type="hidden" name="title"+j id="title"+j value=titles[i].childNodes[0].nodeValue/><input type="hidden" name="nickname"+j id="nickname"+j value=nicknames[i].childNodes[0].nodeValue/>';
var innerhtmlstr= "<input type='hidden' name=title"+j+" id=title"+j+" value="+escape(titles[i-1].childNodes[0].nodeValue)+">"
+"<input type='hidden' name=nickname"+j+" id=nickname"+j+" value="+nicknames[i-1].childNodes[0].nodeValue+">"
+"<input type='hidden' name=photoid"+j+" id=photoid"+j+" value="+photoids[i-1].childNodes[0].nodeValue+">"
+"<input type='hidden' name=userid"+j+" id=userid"+j+" value="+userids[i-1].childNodes[0].nodeValue+">"
+"<input type='hidden' name=email"+j+" id=email"+j+" value="+emailids[i-1].childNodes[0].nodeValue+">";
var inhtmldiv=document.getElementById('p'+j+'m'+j);
inhtmldiv.innerHTML =innerhtmlstr;
var imageholder = document.getElementById('im'+j);
imageholder.src = images[i - 1];
//dom = findDOM('p'+i);
dom = findDOM('p'+j);
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "inline"; //inline
}
dom=findDOM('enlargephotolink'+j);
if(dom)
{
dom.style.display="inline";
}
j = j + 1;
}
if(j != 5)
{
//Add link holder
var linkdiv=document.getElementById('p'+j);
linkdiv.style.visibility = "visible";
dom=findDOM("enlargephotolink"+j);
if(dom){
//dom.style.display="none";
dom.style.visibility="hidden";
}
//linkdiv.style.display = "show";
/*var title = document.getElementById('title'+j);
var nickname = document.getElementById('nickname'+j);
title.value="";
nickname.value="";*/
//document.getElementById('p'+j+'m'+j).innerHTML = '<input type="hidden" name="title"+j id="title"+j value=""/><input type="hidden" name="nickname"+j id="nickname"+j value=""/>';
//var innerhtmlstr= "<input type='hidden' name='title'"+j+"id='title'"+j+"value=''/><input type='hidden' name='nickname'"+j+"id='nickname'"+j+"value=''/>";
//document.getElementById('p'+j+'m'+j).innerHTML =innerhtmlstr;
var innerhtmlstr= "<input type='hidden' name=title"+j+" id=title"+j+" value=''>"
+"<input type='hidden' name=nickname"+j+" id=nickname"+j+" value=''>"
+"<input type='hidden' name=userid"+j+" id=userid"+j+" value=''>"
+"<input type='hidden' name=photoid"+j+" id=photoid"+j+" value=''>";
innerhtmlstr=innerhtmlstr+"<input type='hidden' name=email"+j+" id=email"+j+" value=''>";
var inhtmldiv=document.getElementById('p'+j+'m'+j);
inhtmldiv.innerHTML =innerhtmlstr;
var imageholder = document.getElementById('im'+j);
//imageholder.style.visibility = "visible";
//imageholder.style.display = "show";
//imageholder.src = images[0];
imageholder.src = imageslink[0];
//linkdiv.innerHTML = "<a href='#'>addphoto</a>";//objImage;
//j=j+1;
dom = findDOM('p'+j);
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "inline"; //inline
}
dom=findDOM('enlargephotolink'+j);
if(dom)
{
dom.style.display="inline";
}
}
////////
var j=j+1;
for(j;j <=4; ++j)
{
dom = findDOM('p'+j);
if (dom){
dom.style.display = "none";
}
dom=findDOM('enlargephotolink'+j);
if(dom)
{
dom.style.display="none";
}
}
///////////
/* new
dom = findDOM('next');
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "none"; //inline
}
*/
}
if(totalphotos >= 4)
{
if(end == undefined || end == 0)
{
end=4;
}
balance = totalphotos - end;
//show photos and prev and next link
var i=1;
for(var j=begin;j<=end;++j)
{
var innerhtmlstr= "<input type='hidden' name=title"+i+" id=title"+i+" value="+escape(titles[j-1].childNodes[0].nodeValue)+">"
+"<input type='hidden' name=nickname"+i+" id=nickname"+i+" value="+nicknames[j-1].childNodes[0].nodeValue+">"
+"<input type='hidden' name=photoid"+i+" id=photoid"+i+" value="+photoids[j-1].childNodes[0].nodeValue+">"
+"<input type='hidden' name=userid"+i+" id=userid"+i+" value="+userids[j-1].childNodes[0].nodeValue+">"
+"<input type='hidden' name=email"+i+" id=email"+i+" value="+emailids[j-1].childNodes[0].nodeValue+">";
var inhtmldiv=document.getElementById('p'+i+'m'+i);
inhtmldiv.innerHTML =innerhtmlstr;
var imageholder = document.getElementById('im'+i);
imageholder.src = images[j - 1];
//var photodiv=document.getElementById('p'+i);
//photodiv.innerHTML = imageholder;
dom = findDOM('p'+i);
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "inline"; //inline
}
dom=findDOM('enlargephotolink'+i);
if(dom)
{
dom.style.display="inline";
}
i=i+1;
}
// work if(balance > 0)********
if((totalphotos-begin >2)&&( balance >=0))
// && (((totalphotos-begin)>4)||(!(totalphotos-begin)<=2)))
// if(balance >=0 && (((totalphotos-begin)>4)||(!(totalphotos-begin)<=2)))
// if(balance >=0)
{
//show next div
//var nextdiv = document.getElementById('next');
//nextdiv.style.visibility = "visible";
dom = findDOM('next');
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "inline"; //inline
}
}
if(begin >4)
{
//show prev div
//var prevdiv = document.getElementById('prev');
//prevdiv.style.visibility = "visible";
dom = findDOM('prev');
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "inline"; //inline
}
}
}
if(photoNoForShowLargePicOnload == 0)
{
}
else
{
showlargepic(parseInt(photoNoForShowLargePicOnload));
photoNoForShowLargePicOnload=0;
}
}
function showprev()
{
begin=begin - 4;
end=begin+3;
balance=totalphotos - end;
var j=1;
for(var i=begin;i<=end;++i)
{
var innerhtmlstr= "<input type='hidden' name=title"+j+" id=title"+j+" value="+escape(titles[i-1].childNodes[0].nodeValue)+">"
+"<input type='hidden' name=nickname"+j+" id=nickname"+j+" value="+nicknames[i-1].childNodes[0].nodeValue+">"
+"<input type='hidden' name=photoid"+j+" id=photoid"+j+" value="+photoids[i-1].childNodes[0].nodeValue+">"
+"<input type='hidden' name=email"+j+" id=email"+j+" value="+emailids[i-1].childNodes[0].nodeValue+">"
+"<input type='hidden' name=userid"+j+" id=userid"+j+" value="+userids[i-1].childNodes[0].nodeValue+">";
var inhtmldiv=document.getElementById('p'+j+'m'+j);
inhtmldiv.innerHTML =innerhtmlstr;
var imageholder = document.getElementById('im'+j);
imageholder.src = images[i - 1];
dom = findDOM('p'+j);//i
if (dom){
dom.style.display = "inline"; //inline
}
dom=findDOM('enlargephotolink'+j);
if(dom)
{
dom.style.display="inline";
}
j = j + 1;
}
if(j != 5)
{
//Add link holder
var linkdiv=document.getElementById('p'+j);
linkdiv.style.visibility = "visible";
dom=findDOM("enlargephotolink"+j); if(dom){ dom.style.display="none"; }
var innerhtmlstr= "<input type='hidden' name=title"+j+" id=title"+j+" value=''>"
+"<input type='hidden' name=nickname"+j+" id=nickname"+j+" value=''>"
+"<input type='hidden' name=photoid"+j+" id=photoid"+j+" value=''>"
+"<input type='hidden' name=userid"+j+" id=userid"+j+" value=''>"
+"<input type='hidden' name=email"+j+" id=email"+j+" value=''>";
var inhtmldiv=document.getElementById('p'+j+'m'+j);
inhtmldiv.innerHTML =innerhtmlstr;
var imageholder = document.getElementById('im'+j);
imageholder.src = imageslink[0];
//linkdiv.innerHTML = "<a href='#'>addphoto</a>";//objImage;
j=j+1;
}
for(var k=j; k <=4; ++k)
{
dom = findDOM('p'+k);
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "none"; //inline
}
dom=findDOM('enlargephotolink'+k);
if(dom)
{
dom.style.display="none";
}
}
// work if(balance >=4)
//if((balance >=4) ||(balance == 0) )
if(balance >=0)
{
//show next div
//var nextdiv = document.getElementById('next');
//nextdiv.style.visibility = "visible";
dom = findDOM('next');
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "inline"; //inline
}
}
else
{
dom = findDOM('next');
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "none"; //inline
}
}
if(begin >4)
{
//show prev div
//var prevdiv = document.getElementById('prev');
//prevdiv.style.visibility = "visible";
dom1 = findDOM('prev');
if (dom1){
//dom.innerHTML = imageholder;
dom1.style.display = "inline"; //inline
}
}
else
{
dom1 = findDOM('prev');
if (dom1){
//dom.innerHTML = imageholder;
dom1.style.display = "none"; //inline
}
}
}
////////////////////////////////////////////////////////////////////////////
function shownext()
{
begin=begin + 4;
balance=totalphotos - end;
if(balance >3)
{
end=begin+3;
}
else
{
end=begin+(balance-1);
}
var j=1;
for(var i=begin;i<=end;++i)
{
var innerhtmlstr= "<input type='hidden' name=title"+j+" id=title"+j+" value="+escape(titles[i-1].childNodes[0].nodeValue)+">"
+"<input type='hidden' name=nickname"+j+" id=nickname"+j+" value="+nicknames[i-1].childNodes[0].nodeValue+">"
+"<input type='hidden' name=photoid"+j+" id=photoid"+j+" value="+photoids[i-1].childNodes[0].nodeValue+">"
+"<input type='hidden' name=userid"+j+" id=userid"+j+" value="+userids[i-1].childNodes[0].nodeValue+">"
+"<input type='hidden' name=email"+j+" id=email"+j+" value="+emailids[i-1].childNodes[0].nodeValue+">";
var inhtmldiv=document.getElementById('p'+j+'m'+j);
inhtmldiv.innerHTML =innerhtmlstr;
var imageholder = document.getElementById('im'+j);
imageholder.src = images[i - 1];
dom = findDOM('p'+i);
if (dom){
dom.style.display = "inline"; //inline
}
dom=findDOM('enlargephotolink'+i);
if(dom)
{
dom.style.display="inline";
}
j = j + 1;
}
if(j != 5)
{
//Add link holder
var linkdiv=document.getElementById('p'+j);
linkdiv.style.visibility = "visible";
dom=findDOM("enlargephotolink"+j); if(dom){ dom.style.display="none"; }
var innerhtmlstr= "<input type='hidden' name=title"+j+" id=title"+j+" value=''>"
+"<input type='hidden' name=nickname"+j+" id=nickname"+j+" value=''>"
+"<input type='hidden' name=photoid"+j+" id=photoid"+j+" value=''>"
+"<input type='hidden' name=userid"+j+" id=userid"+j+" value=''>"
+"<input type='hidden' name=email"+j+" id=email"+j+" value=''>";
var inhtmldiv=document.getElementById('p'+j+'m'+j);
inhtmldiv.innerHTML =innerhtmlstr;
//linkdiv.innerHTML = "<a href='#'>addphoto</a>";//objImage;
var imageholder = document.getElementById('im'+j);
imageholder.src = imageslink[0];
j=j+1;
}
/*if(j == 4)
{
j=j;
}
else
{
j=j+1;
}
*/
for(var k=j; k <=4; ++k)
{
dom = findDOM('p'+k);
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "none"; //inline
}
dom=findDOM('enlargephotolink'+k);
if(dom)
{
dom.style.display="none";
}
}
if(balance >=4)
{
//show next div
//var nextdiv = document.getElementById('next');
//nextdiv.style.visibility = "visible";
dom = findDOM('next');
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "inline"; //inline
}
}
else
{
dom = findDOM('next');
if (dom){
//dom.innerHTML = imageholder;
dom.style.display = "none"; //inline
}
}
if(begin >4)
{
//show prev div
//var prevdiv = document.getElementById('prev');
//prevdiv.style.visibility = "visible";
dom1 = findDOM('prev');
if (dom1){
//dom.innerHTML = imageholder;
dom1.style.display = "inline"; //inline
}
}
}
////7**********GET get photos and show--END*****************************************///
function onBlurfun(cellno)
{
hideDOM('mouseoverphotodiv'+cellno);
}
function hidemouseoverphotoinfodiv(cellno)
{
hideDOM('mouseoverphotodiv'+cellno);
}
var largeprevpicno=0; //starts from 0
var largenextpicno=0; //starts from 0
var currentpicno=0; //starts from 0
//begin starts from 1
//cell no is from 1 to 4
function showlargepic(cellno)
{
//hideDOM('hidemouseoverphotoinfodiv'+cellno);
//window.setTimeout("hidemouseoverphotoinfodiv("+cellno+");", 10);//enlarge link in popup
var title = document.getElementById('title'+cellno);
var userid = document.getElementById('userid'+cellno);
var nickname = document.getElementById('nickname'+cellno);
var SPCUID = document.getElementById('SPCUID');
var innerhtmlstr="";
if(nickname.value == 'null' || nickname.value == null)
{
innerhtmlstr="<b>"+unescape(title.value) + "</b><br>"+ "by superpages user";
}
else if(nickname.value != null)
{
innerhtmlstr=unescape(title.value) + "<br>"+ nickname.value;
}
if((userid.value == SPCUID.value)&&(userid.value !='notloggedin'))
{
innerhtmlstr = innerhtmlstr + "<br>" + "(that's you)";
}
//var innerhtmlstr=title.value + "***"+ nickname.value;
dom=findDOM("largepicbottomtext");
if(dom)
{
dom.innerHTML=innerhtmlstr;
dom.style.cssText='background-color:white;width:576px;';
dom.style.display="block";
}
currentpicno=begin+cellno-2;
var largeimageholder= document.getElementById('LargeImage');
largeimageholder.src = largeimages[begin+cellno-2]; //index starts from 0
//alert("largeimageholderheight="+largeimages[begin+cellno-2].height);
var cssString = 'margin-top:'+((576-imagesfordimentions[begin+cellno-2].height)/2)+'px;';
cssString=cssString+'margin-bottom:'+((576-imagesfordimentions[begin+cellno-2].height)/2)+'px;';
cssString=cssString+'padding-left:'+((576-imagesfordimentions[begin+cellno-2].width)/2)+'px;';
cssString=cssString+'padding-right:'+((576-imagesfordimentions[begin+cellno-2].width)/2)+'px;';
if( typeof(largeimageholder.style.cssText) == 'string' ) {
largeimageholder.style.cssText = cssString;
}
largeimageholder.setAttribute('style',cssString);
if((begin+cellno-2) == 0){ //if its the first pic, dont show prev arrow
currentpicno=0;
largeprevpicno=currentpicno;
dom=findDOM('largeprev');
if(dom)
{
dom.style.display="none";
}
}
else
{//if its not the first pic, show prev arrow
largeprevpicno=currentpicno-1;
dom=findDOM('largeprev');
if(dom)
{
dom.style.display="inline";
}
}
if((begin+cellno-2)!= (largeimages.length-1)){//if its not the last pic, show next arrow
//largenextpicno=(begin+cellno-2)+1;
largenextpicno=currentpicno+1;
//currentpicno=currentpicno+1;
dom=findDOM('largenext');
if(dom)
{
dom.style.display="inline"
}
}
else//if its the last pic, dont show next arrow
{
dom=findDOM('largenext');
if(dom)
{
dom.style.display="none";
}
}
P7_Snap('view_photo_link','enlargephotodiv',0,-670);
showDOM('enlargephotodiv');
}
function showprevlargepic()
{
var largeimageholder= document.getElementById('LargeImage');
largeimageholder.src = largeimages[largeprevpicno];
var cssString = 'margin-top:'+((576-largeimageholder.height)/2)+'px;';
cssString=cssString+'margin-bottom:'+((576-largeimageholder.height)/2)+'px;';
cssString=cssString+'padding-left:'+((576-largeimageholder.width)/2)+'px;';
cssString=cssString+'padding-right:'+((576-largeimageholder.width)/2)+'px;';
if( typeof(largeimageholder.style.cssText) == 'string' ) {
largeimageholder.style.cssText = cssString;
}
var title=escape(titles[largeprevpicno].childNodes[0].nodeValue);
var nickname = nicknames[largeprevpicno].childNodes[0].nodeValue;
var userid = userids[largeprevpicno].childNodes[0].nodeValue;
var SPCUID = document.getElementById('SPCUID');
var innerhtmlstr="";
if(nickname == 'null' || nickname == null)
{
innerhtmlstr="<b>"+ unescape(title) + "</b><br>"+ "by superpages user";
}
else if(nickname != null)
{
innerhtmlstr="<b>"+ unescape(title) + "</b><br>"+ nickname;
}
if((userid == SPCUID.value)&&(userid !='notloggedin'))
{
innerhtmlstr = innerhtmlstr + "<br>" + "(that's you)";
}
dom=findDOM("largepicbottomtext");
if(dom)
{
dom.innerHTML=innerhtmlstr;
dom.style.cssText='background-color:white;width:576px;';
dom.style.display="block";
}
//showlargepic();
//showbuttons();
dom=findDOM('largenext');
if(dom)
{
dom.style.display="inline";
}
//if((largeprevpicno) == 0){ //if its the first pic, dont show prev arrow
if((currentpicno == 0) || (largeprevpicno == 0)){ //if its the first pic, dont show prev arrow
dom=findDOM('largeprev');
if(dom)
{
dom.style.display="none";
}
}
else{//if its not the first pic, show prev arrow
//largeprevpicno=(largeprevpicno)-1;
//largeprevpicno=(largenextpicno)-1;
currentpicno=largeprevpicno;
largenextpicno=(currentpicno)+1;
largeprevpicno=(currentpicno-1);
dom=findDOM('largeprev');
if(dom)
{
dom.style.display="inline";
}
}
}
function shownextlargepic()
{
var largeimageholder= document.getElementById('LargeImage');
largeimageholder.src = largeimages[largenextpicno];
var cssString = 'margin-top:'+((576-largeimageholder.height)/2)+'px;';
cssString=cssString+'margin-bottom:'+((576-largeimageholder.height)/2)+'px;';
cssString=cssString+'padding-left:'+((576-largeimageholder.width)/2)+'px;';
cssString=cssString+'padding-right:'+((576-largeimageholder.width)/2)+'px;';
if( typeof(largeimageholder.style.cssText) == 'string' ) {
largeimageholder.style.cssText = cssString;
}
var title=escape(titles[largenextpicno].childNodes[0].nodeValue);
var nickname = nicknames[largenextpicno].childNodes[0].nodeValue;
var userid = userids[largeprevpicno].childNodes[0].nodeValue;
var SPCUID = document.getElementById('SPCUID');
var innerhtmlstr="";
if(nickname == 'null' || nickname == null)
{
innerhtmlstr="<b>"+ unescape(title) + "</b><br>"+ "by superpages user";
}
else if(nickname != null)
{
innerhtmlstr="<b>"+ unescape(title) + "</b><br>"+ nickname;
}
if((userid == SPCUID.value)&&(userid !='notloggedin'))
{
innerhtmlstr = innerhtmlstr + "<br>" + "(that's you)";
}
dom=findDOM("largepicbottomtext");
if(dom)
{
dom.innerHTML=innerhtmlstr;
dom.style.cssText='background-color:white;width:576px;';
dom.style.display="block";
}
dom=findDOM('largeprev');
if(dom)
{
dom.style.display="inline";
}
//showbuttons();
if((largenextpicno)!= (largeimages.length-1)){//if its not the last pic, show next arrow
currentpicno=largenextpicno;
largenextpicno=(currentpicno)+1;
largeprevpicno=(currentpicno)-1;
dom=findDOM('largenext');
if(dom)
{
dom.style.display="inline"
}
}
else//if its the last pic, dont show next arrow
{
currentpicno=largenextpicno;
largeprevpicno=(currentpicno)-1;
dom=findDOM('largenext');
if(dom)
{
dom.style.display="none";
}
}
}
function findforaddlink(cellno)
{
var testforaddphotoimg=document.getElementById('im'+cellno);
var addphotoimage=testforaddphotoimg.src;
if(addphotoimage.indexOf("addYourPhoto")>0)
{
hideDOM('viewphotos');
dom=findDOM('xmlphoto');
if(dom)
{
document.location.href=bpurl;
}else{
showugcDOM('picugcForm1'); }
}
else
{
showlargepic(parseInt(cellno));
}
}
function showmouseoverphotoinfodiv(cellno,username)//later username willbe replaced by ID
{
phn = cellno;
var mouseoverphotodivname='mouseoverphotodiv'+cellno;
var imgLocation = imgLoc;
dom = findDOM(mouseoverphotodivname);
if (dom){
var title = document.getElementById('title'+cellno);
var userid = document.getElementById('userid'+cellno);
var nickname = document.getElementById('nickname'+cellno);
var SPCUID = document.getElementById('SPCUID');
var divWidth = '175px';
var tablWidth = '160px';
if(userid.value == SPCUID.value &&(userid.value !='notloggedin'))
{
divWidth = '265px';
tablWidth = '255px';
}
if(title.value || userid.value)
{
var innerhtmlmouseoverphotostr="<div style='width:" + divWidth + "' id='roundcorn1'><b class='rdtop1'><b class='rdb11'></b><b class='rdb21'></b><b class='rdb31'></b><b class='rdb41'></b></b>"+
"<div class='rdbordcontent1'><table border='0' CELLSPACING='0' CELLPADDING='0' width='" + tablWidth + "'>";
if(title.value != 'null'){ //alert("gg="+innerhtmlmouseoverphotostr);
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"<tr><td style='font-family: Arial;font-size:12px;padding-left:15px;' align='left'><b>"+unescape(title.value)+"</b></td></tr>";
/*+"<td style='font-family: Arial;font-size:12px;padding-left:15px;' align='right'><b><a href='javascript:;' onclick='showlargepic("+cellno+")';return false;' >Enlarge</a></b></td>"+*/
}
else if(title.value == 'null'){
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"<tr><td style='font-family: Arial;font-size:12px;padding-left:15px;' align='left'><b>&nbsp;</b></td></tr>"+
"<input type='hidden' name='TIT' id='TIT' value="+(title.value)+">";
}
else{
innerhtmlmouseoverphotostr="<tr><td>&nbsp;</td></tr>"+
"<input type='hidden' name='TITLE' id='TITLE' value=''>";
}
var nickval=nickname.value;
if(nickval == 'null')
{
innerhtmlmouseoverphotostr =innerhtmlmouseoverphotostr+"<tr><td style='font-family: Arial;font-size:11px;padding-left:15px;'>by superpagesuser</td></tr>"+
"<input type='hidden' name='NICK' id='NICK' value='superpagesuser'>";
}
else if(nickval != 'null')
{
innerhtmlmouseoverphotostr =innerhtmlmouseoverphotostr+"<tr><td style='font-family: Arial;font-size:11px;padding-left:15px;'>"+"by "+nickname.value+"</td></tr>"+
"<input type='hidden' name='NICK' id='NICK' value="+nickname.value+">";
}
else
{
innerhtmlmouseoverphotostr =innerhtmlmouseoverphotostr+"<tr><td style='font-family: Arial;font-size:11px;padding-left:15px;'>by superpagesuser</td></tr>"+
"<input type='hidden' name='NICK' id='NICK' value='superpagesuser'>";
}
if((userid.value == SPCUID.value)&&(userid.value !='notloggedin'))
{
var editmouseoverdiv='mouseoverphotoeditdiv';
var deletemouseoverdiv='mouseoverphotodeletediv';
thisdiv = "edit";
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"<tr><td style='font-family: Arial;font-size:11px;padding-left:15px;'>(that's you)</td></tr>"
+"<tr><td>&nbsp;</td></tr>"
+"<tr><td style='padding-left:15px;' align='right'><input style='vertical-align: middle;'type='image' src='"+imgLocation+"edit_button.gif'"
+"name='submitAddr' value='Edit' onclick='hideDOM(\""+mouseoverphotodivname+"\");showphotoeditDOM(\""+editmouseoverdiv+"\","
+"\""+cellno+"\");return false;'>&nbsp;&nbsp;&nbsp;&nbsp;"
+"<input style='vertical-align: middle;' type='image' src='"+imgLocation+"delete_button.gif' name='submitAddr' value='Delete'"
+"onclick='hideDOM(\""+mouseoverphotodivname+ "\");showphotodeleteDOM(\""+deletemouseoverdiv+"\",\""+cellno+"\"); return false;'>&nbsp;&nbsp;"
+"<input style='vertical-align: middle;' type='image' src='"+imgLocation+"cancel_button.gif' name='submitAddr' value='Cancel' "
+"onclick='hidemouseoverphotoinfodiv(\""+cellno+"\"); return false;'></td><tr/>";
}
else{
thisdiv = "";
}
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"</table>"+
"</div><b class='rdbottom1'><b class='rdb41'></b><b class='rdb31'></b><b class='rdb21'></b><b class='rdb11'></b></b></div>";
dom.innerHTML =innerhtmlmouseoverphotostr;
dom.style.display = "inline";
}
}
}
function showmouseoverphotoedituserinfodiv(cellno)//later username willbe replaced by ID
{
var mouseoverphotousereditdivname="mouseoverphotousereditdiv"+cellno;
var innerdivname="roundcorn"+cellno;
var selectbox=document.getElementById('userappearas'+cellno);
var optval=document.getElementById('nickname'+cellno);
var optvalue=optval.value;
if(optvalue){
if(selectbox.length == 0){
optvalue="superpagesuser";
var option = document.createElement("option");
option.appendChild(document.createTextNode(optvalue));
option.value=optval.value;
selectbox.appendChild(option);
var optval=document.getElementById('email'+cellno);
var option = document.createElement("option");
option.appendChild(document.createTextNode(optval.value));
option.value=optval.value;
selectbox.appendChild(option);
}
innerdom = findDOM(innerdivname);
if(innerdom)
{
innerdom.style.display = "inline";
}
dom = findDOM(mouseoverphotousereditdivname);
if (dom){
var nickname = "ashaJ";
var errortext="xxx data";
dom.style.display = "inline";
}
}
}
// 11
function showphotoeditDOM(id, cellno)
{
var mouseoverphotodivname='mouseoverphotodiv'+cellno;
var imgLocation = imgLoc;
dom = findDOM(id+cellno);
if (dom){
var title = document.getElementById('title'+cellno);
var nickname = document.getElementById('nickname'+cellno);
var showusereditdiv="mouseoverphotousereditdiv"+cellno;
var innerhtmlmouseoverphotostr="<div style='width:235px;' id='roundcorn1'><b class='rdtop1'><b class='rdb11'></b><b class='rdb21'></b><b class='rdb31'></b><b class='rdb41'></b></b>"+
"<div class='rdbordcontent1'><table border='0' width='230'><tr><td colspan='4' style='font-family: Arial;font-size:12px;padding-left:12px;'"+
"align='left'>";
if(title.value != 'null'){
innerhtmlmouseoverphotostr = innerhtmlmouseoverphotostr+"<div style='overflow:auto'><input style='font-family: Arial;font-size:11px;' size='33' maxlength='33' type='text'"+
"id='edittitle' name='edittitle' value="+(unescape(title.value))+"></div></td></tr>";
}
if(title.value == 'null'){
innerhtmlmouseoverphotostr = innerhtmlmouseoverphotostr+"<input style='font-family: Arial;font-size:11px;' size='33' maxlength='33' type='text'"+
"id='edittitle' name='edittitle' value=''></td></tr>";
}
var nickname1=nickname.value;
var nickval=nickname.value;
if(nickval == 'null'){
nickval="superpagesuser";
}
else
{
nickval=nickname.value;
}
if(nickval)
{
var mouseoverphotoeditdiv="mouseoverphotousereditdiv"+cellno;
var pm="mouseoverphotoeditdiv"+cellno;
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"<tr><td colspan='4' style='font-family: Arial;font-size:12px;padding-left:12px;'>You will be seen as</td></tr>"
+"<tr><td colspan='4' style='font-family: Arial;font-size:12px;padding-left:12px;' colspan=3 align='left'><b>"
+nickval
+"</b>&nbsp;<span style='font-family: Arial;font-size:10px;'>[<a href='javascript:;' class='ugcAddEdtLink' onclick='showmouseoverphotoedituserinfodiv("+cellno+"); return false;'>edit</a>]</span> </td></tr>";
}
var userselect="mouseoverphotousereditdiv"+cellno;
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"<tr><td>&nbsp;</td></tr><tr><td colspan='3' align='right'><input style='vertical-align: middle;' type='image' src='"+imgLocation+"save_button.gif'"
+"title='Save' name='Save' value='Save' onclick=' hideDOM(\""+userselect+"\"); hideDOM(\""+id+cellno+"\"); sendeditphotodata(\""+cellno+"\""
+"); return false;'>&nbsp;&nbsp;<input style='vertical-align: middle;' type='image' src='"+imgLocation+"cancel_button.gif' name='Cancel' title='Cancel' value='Cancel' onclick='hideDOM(\""+userselect+"\");hideDOM(\""+id+cellno+"\"); return false;'></td></tr>"
+"</table></div><b class='rdbottom1'><b class='rdb41'></b><b class='rdb31'></b><b class='rdb21'></b><b class='rdb11'></b></b></div>";
dom.innerHTML =innerhtmlmouseoverphotostr;
dom.style.display = "inline";
}
}
////3**********POST send Payment--BEGIN*********************************************///
var xmlHttp;
function createphotoeditXML(cellno) {
var newtitle=document.getElementById('edittitle');
var xml = "<Photos>";
var photoid =document.getElementById("photoid"+cellno);//from check box
xml = xml + "<photoId>";
xml = xml + photoid.value + "<\/photoId>";
xml = xml + "<title>";
xml = xml + encodeURIComponent(newtitle.value) + "<\/title>";
xml = xml + "<\/Photos>";
return xml;
}
function sendeditphotodata(cellno) {
if (typeof ActiveXObject != "undefined") {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
////////////////////
// var xml = createphotoeditXML(cellno);
var urllink = "";
var newtitl=document.getElementById('edittitle');
/**********todo B**********/
var tv=newtitl.value;
var regExp = /\s+/g;
var titleValue = tv.replace(regExp,'+');
/*********todo E**********/
//var titleValue=newtitl.value; //new
var photoid =document.getElementById("photoid"+cellno);
var userappearas=document.getElementById("userappearas"+cellno);//select
var uservalue=null;
var dataEdited='no';
// var url = 'http://nbttest1.superpages.com:9080/ugcwiki/GetPhotoServlet?title='+newtitle.value+'&photoId='+photoid.value+'&nick='+uservalue;
// var url = 'http://nbttest1.superpages.com:9080/ugcwiki/GetPhotoServlet?';
var url = hostServ+'/bp/xmlproxy?url='+datServ+'/ugcwiki/GetPhotoServlet?';
//var nick=document.getElementById('NICK');
if(userappearas.length>0){
if(userappearas.options[0].selected ){
uservalue=userappearas.options[0].text;
//alert("userappearas.options[0].text"+userappearas.options[0].text);
//alert("NICK.value"+nick.value);
//if(userappearas.options[0].text != nick.value){
urllink="nick="+uservalue;
dataEdited='yes';
}
else
{
//alert("userappearas.options[1].text"+userappearas.options[1].text);
//alert("NICK.value"+nick.value);
uservalue=userappearas.options[1].text;
//if(userappearas.options[1].text != nick.value){
urllink=urllink+"nick="+uservalue;
dataEdited='yes';
}
}
//var TITLE=document.getElementById('TIT');
//if(titleValue != TITLE.value){
//*******todo B *******/
urllink=urllink+"&title="+titleValue;
//*******todo E *******/
//url=url+"%26title=ddd%20ggg";
dataEdited='yes';
// }
if(dataEdited == 'yes'){
urllink=urllink+"&photoId="+photoid.value;
dataEdited='no';
}
//var url = 'http://nbttest1.superpages.com:9080/ugcwiki/GetPhotoServlet?title='+newtitle.value+'&photoId='+photoid.value;
// var url = 'http://nbttest1.superpages.com:9080/ugcwiki/GetPhotoServlet?title='+newtitle.value+'&photoId='+photoid.value+'&nick='+uservalue;
// xmlHttp.open("POST", url, true);
// url=encodeURIComponent(url);
/********todo B************/
//encodeURI
var tUrl = url + encodeURIComponent(urllink);
/********todo E*********/
xmlHttp.open("GET", tUrl, true);
xmlHttp.onreadystatechange = handleeditphotoStateChange;
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
//xmlHttp.send(xml);
xmlHttp.send(null);
}
function handleeditphotoStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
parseeditphotoResults();
}
}
}
function parseeditphotoResults() {
// var message = xmlHttp.responseXML.getElementsByTagName("Success")[0];
getphotos(listingno);
}
////3**********POST send Payment--END*********************************************///
// 12
function showphotodeleteDOM(id, cellno)
{
var mouseoverphotodivname='mouseoverphotodiv'+cellno;
var imgLocation = imgLoc;
dom = findDOM(id+cellno);
if (dom){
var title = document.getElementById('title'+cellno);
var nickname = document.getElementById('nickname'+cellno);
var innerhtmlmouseoverphotostr="<div style='width:235px;' id='roundcorn1'><b class='rdtop1'><b class='rdb11'></b><b class='rdb21'></b><b class='rdb31'></b><b class='rdb41'></b></b>"+
"<div class='rdbordcontent1'><table border='0' width='230'>"+
"<tr><td colspan='2' style='font-family: Arial;font-size:13px;padding-left:12px'><b>Are you sure you want to<br/> delete this photo?</b> </td></tr>";
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"<tr><td height='45px'>&nbsp;</td></tr><tr>";
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"<td align='right'><input style='vertical-align: bottom;' type='image'"+
"type='image' src='"+imgLocation+"ok_button.gif'name='OK' title='OK' value='OK' onclick='hideDOM(";
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"\""+id+cellno+"\"";
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"); senddeletephotodata(";
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"\""+cellno+"\"";
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"); return false;'>";
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"&nbsp;&nbsp;"+
"<input style='vertical-align: middle;' type='image' src='"+imgLocation+"cancel_button.gif'"+
"name='Cancel' title='Cancel' value='Cancel'onClick='hideDOM(";
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"\""+id+cellno+"\"";
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"); return false;'></td>";
innerhtmlmouseoverphotostr=innerhtmlmouseoverphotostr+"</tr></table>"+
"</div><b class='rdbottom1'><b class='rdb41'></b><b class='rdb31'></b><b class='rdb21'></b><b class='rdb11'></b></b></div>";
dom.innerHTML =innerhtmlmouseoverphotostr;
dom.style.display = "inline";
}
}
////3**********POST send Payment--BEGIN*********************************************///
var xmlHttp;
var gcellno;
function senddeletephotodata(cellno) {
gcellno = cellno;
if (typeof ActiveXObject != "undefined") {
xmlHttp = new ActiveXObject('MSXML2.XMLHTTP.3.0');
}else if (typeof XMLHttpRequest != "undefined") {
xmlHttp = new XMLHttpRequest();
}
////////////////////
// var xml = createphotoeditXML(cellno);
var photoid =document.getElementById("photoid"+cellno);
//var url = 'http://nbttest1.superpages.com:9080/ugcwiki/GetPhotoServlet?delFlag=yes&iconid='+photoid.value;
var url = hostServ+'/bp/xmlproxy?url=' + encodeURIComponent(datServ+'/ugcwiki/GetPhotoServlet?delFlag=yes&iconid='+photoid.value);
// xmlHttp.open("POST", url, true);
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = handledeletephotoStateChange;
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
//xmlHttp.send(xml);
xmlHttp.send(null);
}
function handledeletephotoStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
parsedeletephotoResults();
}
}
}
function parsedeletephotoResults() {
//del balance=balance-1;
totalphotos=0;
begin=0;
end=0;
balance=0;
getphotos(listingno);
}
////3**********POST send Payment--END*********************************************///