Var Windows

Embed Size (px)

Citation preview

  • 8/3/2019 Var Windows

    1/91

    var windows_count = 0, send_btn_count = 0, visiturl_btn_count = 0,close_btn_count = 0, minimize_btn_count = 0, typing_status_count = 0,minimize_status_count = 0, maximize_btn_count = 0, online_btn_count = 0,offline_btn_count = 0;var layout, whotostyle, currentSelectedElement, whotoupload,closeUploadingPanel;

    // Help Alert Messages //var poisitioningAlertMessage = "This area is usedto show Positioning and resizing info of the Selected Element and also to setthe position and region of the element. You can see the info as well as setit at any point in time, just set the values in the text boxes and then clickthe button apply settings.";var poisitioningWindowAlertMessage = "This areais used to Set the Position the of the generated window that will apear onthe customer's website, you can set it by selecting position from the grid.by default its on the bottom-right corner of your website.
    You can alsogo specific on the positioning by entering the X and Y coordinates in thetextbox for X-axis and Y-axis.

    Note: Please enter valuesbetween 300 and -300. ";

    var enterwebsiteurl = "Please Enter the URL ofyour website in the textbox to see the window on the specified website whenpreviewing.";var elementsettings = "Check the checkboxes belowto have border on the generated window's text boxes. by default there's noborder."var enterimageurl = "Please Enter the absoluteURL of the image in the textbox and press apply button to use your imageinstead of the default buttons in the chat window generator.";var adanimation = "Dummy.";// End help Alerts//

    var name = new Array();name["minimize_wrap"] = "Minimize Button";name["close_wrap"] = "Close Button";name["cwg_ConversationWin"] = "Conversation TextBox";name["cwg_MessageWin"] = "Message TextBox";name["send_wrap"] = "Send Button";name["visiturl_wrap"] = "Open Link Button";name["typingstatus_wrap"] = "Typing Status";name["minimize"] = "Minimize Button";name["close"] = "Close Button";name["send"] = "Send Button";name["visiturl"] = "Open Link Button";name["typingstatus"] = "Typing Status";

    name["livehostwraper"] = "Live Host Name";name["convwraper"] = "View Complete Conversation";name["labelwraper"] = "Powered By Label";name["addStyleHostName"] = "Host Name";name["addStyleHostConversation"] = "Host Conversation";name["addStyleVisitorName"] = "Visitor Name";name["addStyleVisitorConversation"] = "Visitor Conversation";name["logo"] = "Your Company's Logo";name["cwg_languages_box"] = "Language Box";name["cwg_chatDiv"] = "Skin";

  • 8/3/2019 Var Windows

    2/91

    var Dom = YAHOO.util.Dom,

    Event = YAHOO.util.Event;var resize = new Array();

    var fadeInID;var Server_Response;var upload_panel_control;var myEditor

    //varConversationWinresize,sendbuttonresize,MessageWinresize,VisitUrlresize,backgroundresize;Event.onDOMReady(function() {

    //debugger;layout = new YAHOO.widget.Layout({

    units: [{ position: 'top', height: 60, body: 'top1' },{ position: 'right', width: 130, resize: false, collapse: false,

    scroll: false, body: 'right1', animate: true, gutter: '0' },{ position: 'bottom', height: 165, body: 'bottom1', collapse:

    false, gutter: '0' },{ position: 'left', width: 220, collapse: true, scroll: false,

    animate: true, body: 'left1', gutter: '0' },{ position: 'center', body: 'center1', gutter: '0' }

    ]});

    layout.render();

    Dom.setStyle("LIVELOGO", "opacity", ".6");layout.getUnitByPosition('bottom').collapse();Event.delegate(document.body, "click", deSelectElement, "div");

    var cwg_ConversationWin = document.createElement("div");cwg_ConversationWin.id = "cwg_ConversationWin";document.getElementById('cwg_chatDiv').appendChild(cwg_ConversationWin);createStyleDiv("addStyleConversationwin", cwg_ConversationWin, "Style");createTextDiv("addStyleHostName", cwg_ConversationWin, "Host : ");createTextDiv("addStyleHostConversation", cwg_ConversationWin, "Host

    Conversation Text Comes here.. ");

    var cwg_MessageWin = document.createElement("div");cwg_MessageWin.id = "cwg_MessageWin";

    document.getElementById('cwg_chatDiv').appendChild(cwg_MessageWin);createStyleDiv("addStyleMessagewin", cwg_MessageWin, "Style");createTextDiv("addStyleVisitorName", cwg_MessageWin, "Visitor : ");createTextDiv("addStyleVisitorConversation", cwg_MessageWin, "Visitor

    Conversation Text Comes here.. ");

  • 8/3/2019 Var Windows

    3/91

    var backgroundresize = new YAHOO.util.Resize('cwg_chatDiv', {handles: ['r', 'b', 'br'],knobHandles: true,proxy: true,status: true,draggable: true,autoRatio: true,maxWidth: 500,maxHeight: 500,minWidth: 300,minHeight: 300

    });

    var msgWin = new YAHOO.util.Resize("cwg_MessageWin", {handles: 'all',proxy: true,ghost: true,hover: true,draggable: true,

    autoRatio: true,status: true,minWidth: 20,maxWidth: 500,minHeight: 20,maxHeight: 400

    });msgWin.on('dragEvent', function() {

    currentSelectedElement = this;elementCurrentPosition("Message TextBox");

    });msgWin.on('resize', function() {

    currentSelectedElement = this;elementCurrentRegion("Message TextBox");

    });

    var convWin = new YAHOO.util.Resize("cwg_ConversationWin", {handles: 'all',proxy: true,ghost: true,hover: true,draggable: true,autoRatio: true,status: true,

    minWidth: 20,maxWidth: 500,minHeight: 20,maxHeight: 400

    });convWin.on('dragEvent', function() {

    currentSelectedElement = this;elementCurrentPosition("Conversation TextBox");

    });

  • 8/3/2019 Var Windows

    4/91

    convWin.on('resize', function() {currentSelectedElement = this;elementCurrentRegion("Conversation TextBox");

    });

    var handleFailure = function(o) {msgalert("Problem with your internet

    connection" + o.responseText);

    }

    var handleSuccess = function(o) {

    if (o.responseText !== undefined) {Server_Response = o.responseText;

    }

    }

    var callback = {success: handleSuccess,failure: handleFailure

    };

    //its call the getSkin.aspxvar request = YAHOO.util.Connect.asyncRequest('POST', "getSkins.aspx",

    callback);

    });

    function bringwindows() {

    layout.getUnitByPosition("bottom").toggle();

    }

    function make_carousel(windows_response, path, carousel, config, HandleName,ratio) {

    // Add Carousel //var olist = document.createElement("ol");olist.setAttribute("class", "yui-carousel-element");olist.id = "carousel";

    for (var i = 1; i

  • 8/3/2019 Var Windows

    5/91

    $(image).load(function() {

    $($(this).parent()).removeClass('loading'); //.append(this);$(this).fadeIn();var attributes = {

    opacity: { to: 1 }};

    var anim = new YAHOO.util.Anim(this, attributes);anim.animate();

    Dom.setStyle(document.body, "opacity", "1");});

    image.src = path + windows_response[i];

    image.setAttribute("class", carousel);

    var source = windows_response[i];var title = source.split('.')image.setAttribute("Title", title[0]);if (HandleName === "maxbutton") {

    image.setAttribute("onClick", "placeMaximizeButton(this.src)");

    } else {if (carousel !== "containerbg") {

    image.setAttribute("onClick", "placeButton(this.src,'" +HandleName + "')");

    }}var list = document.createElement("li");list.appendChild(image);list.setAttribute("class", "item loading");

    //list.width = "30";

    olist.appendChild(list);

    }Dom.get(carousel).appendChild(olist);

    YAHOO.widget.Carousel.prototype.CONFIG.MAX_PAGER_BUTTONS = 8;YAHOO.widget.Carousel.prototype.CONFIG.PAGER_PREFIX_TEXT = "Page";HandleName = new YAHOO.widget.Carousel(carousel, config);HandleName.render(); // get ready for rendering the widget

  • 8/3/2019 Var Windows

    6/91

    HandleName.show(); // display the widget$('.' + carousel).jScale({ ls: ratio });

    }

    function displayColor() {document.getElementById("colorpicker").style.display = 'block';

    }

    function Barva(color) {

    Dom.setStyle("chosencolor", 'background-color', color);

    document.getElementById("colorpicker").style.display = 'none';}

    function createTextDiv(DivId, parent, Text) {

    var addTextdiv = document.createElement("span");addTextdiv.id = DivId;

    addTextdiv.setAttribute("onmouseover", "this.innerHTML='Click me to style'");

    addTextdiv.setAttribute("onmouseout", "this.innerHTML='" + Text + "'");addTextdiv.onclick = function(e) {

    styling(addTextdiv.id);if (!e) var e = window.event;e.cancelBubble = true;if (e.stopPropagation) e.stopPropagation();

    }

    var addText = document.createTextNode(Text);addTextdiv.appendChild(addText);parent.appendChild(addTextdiv);

    }

    function createStyleDiv(StyleDivId, parent, text) {

    var addstylediv = document.createElement("div");addstylediv.id = StyleDivId;var addstyle = document.createTextNode(text);Dom.setStyle(addstyle, 'float', 'right');

    parent.setAttribute("onmouseover", "showStylingDiv('" + StyleDivId +"')");

    parent.setAttribute("onmouseout", "hideStylingDiv('" + StyleDivId +"')");

  • 8/3/2019 Var Windows

    7/91

    parent.setAttribute("onclick", "styling('" + parent.id + "')");

    Dom.setStyle(parent, 'text-align', 'left');Dom.setStyle(parent, 'float', 'left');Dom.setStyle(parent, 'position', 'absolute');

    addstylediv.appendChild(addstyle);addstylediv.className = "add-style";parent.appendChild(addstylediv);

    }

    function createUploadDiv(StyleDivId, parent, text) {

    var addstylediv = document.createElement("div");addstylediv.id = StyleDivId;var addstyle = document.createTextNode(text);Dom.setStyle(addstyle, 'float', 'right');

    parent.setAttribute("onmouseover", "showStylingDiv('" + StyleDivId +

    "')");parent.setAttribute("onmouseout", "hideStylingDiv('" + StyleDivId +

    "')");addstylediv.setAttribute("onclick", "uploading('" + parent.id + "')");

    Dom.setStyle(parent, 'text-align', 'left');Dom.setStyle(parent, 'float', 'left');Dom.setStyle(parent, 'position', 'absolute');

    addstylediv.appendChild(addstyle);addstylediv.className = "add-upload";parent.appendChild(addstylediv);

    }

    function createAdDiv(StyleDivId, parent, text) {debugger;var addstylediv = document.createElement("div");addstylediv.id = StyleDivId;var addstyle = document.createTextNode(text);Dom.setStyle(addstyle, 'float', 'right');

    parent.setAttribute("onmouseover", "showStylingDiv('" + StyleDivId +"')");

    parent.setAttribute("onmouseout", "hideStylingDiv('" + StyleDivId +"')");

    addstylediv.setAttribute("onclick", "adanim('" + parent.id + "')");

    Dom.setStyle(parent, 'text-align', 'left');Dom.setStyle(parent, 'float', 'left');Dom.setStyle(parent, 'position', 'absolute');

    addstylediv.appendChild(addstyle);addstylediv.className = "add-upload";parent.appendChild(addstylediv);

    }var browseAnimationImageDD = new YAHOO.util.DD('browseAnimationImage');var animationPrevieweDD = new YAHOO.util.DD('animationPreview');

  • 8/3/2019 Var Windows

    8/91

    function setNumberOfImages() {

    debugger;var noofboxes =

    $get("noofimages").options[$get("noofimages").selectedIndex].value;var container = Dom.get("textboxes_animation");var count = 0;var alreadyboxes = Dom.getChildren(container);

    for (count = 0; count < alreadyboxes.length; count++) {

    Dom.get("textboxes_animation").removeChild(alreadyboxes[count]);}

    for (count = 0; count < noofboxes; count++) {

    var textbox = document.createElement("input");textbox.setAttribute("type", "text");textbox.value = "Paste your link here or click upload";

    textbox.className = "animationText";textbox.id = "textbox-" + count;

    var upload = document.createElement("input");upload.setAttribute("type", "button");//upload.setAttribute("value","upload from computer");upload.id = "upload-" + count;upload.onclick = function() {

    document.getElementById('WG_AnimationFrame').src ="animationUploading.aspx?id=" + this.id;

    Dom.setStyle("browseAnimationImage", "display", "block");}upload.className = "upload";

    container.appendChild(textbox);container.appendChild(upload);

    }

    }function adanim(parent) {

    Dom.setStyle("addanimation", "display", "block");}function cancelAnimation() {

    Dom.setStyle("addanimation", "display", "none");

    }

    function cancelUploading() {Dom.setStyle("upload_input", "display", "none");document.getElementById("previewImag").src = "";document.getElementById("upload_url").value = "";

    }function cancelUploadingAnimation() {

    Dom.setStyle("browseAnimationImage", "display", "none");

  • 8/3/2019 Var Windows

    9/91

    }function setUploadSrc() {

    resiz[whotoupload.id].destroy();

    var newImg = new Image();newImg.src = document.getElementById("upload_url").value;var curHeight = newImg.height ? newImg.height : newImg.style.height;var curWidth = newImg.width ? newImg.width : newImg.style.width;

    whotoupload.src = document.getElementById("upload_url").value;whotoupload.style.height = curHeight;whotoupload.style.width = curWidth;

    resiz[whotoupload.id] = new YAHOO.util.Resize(whotoupload.id, {handles: ['r', 'b', 'br'],proxy: true,ghost: true,hover: true,draggable: true,

    autoRatio: true,status: true,minWidth: 10,minHeight: 10,maxHeight: 150

    });resiz[whotoupload.id].on('dragEvent', function() {

    currentSelectedElement = this;elementCurrentPosition(name[whotoupload.id]);

    });resiz[whotoupload.id].on('resize', function() {

    currentSelectedElement = this;elementCurrentRegion(name[whotoupload.id]);

    });

    Dom.setStyle("upload_input", "display", "none");document.getElementById("previewImag").src = "";document.getElementById("upload_url").value = "";

    }

    function previewUploadSrc() {document.getElementById("previewImag").src =

    document.getElementById("upload_url").value;

    }function styling(id) {

    Dom.setStyle("stylingdiv", "display", "block");Dom.setStyle("TextBoxStyleDiv", "display", "none");Dom.setStyle("textStyleDiv", "display", "block");

    switch (id) {case"livehostwraper":

    whotostyle = "cwin_username";

  • 8/3/2019 Var Windows

    10/91

    document.getElementById('cwg_selected_element').innerHTML =name[id];

    break;case"convwraper":

    whotostyle = "convspan";document.getElementById('cwg_selected_element').innerHTML = "View

    Conversation";break;

    case"labelwraper":whotostyle = "any_Label"document.getElementById('cwg_selected_element').innerHTML =

    name[id];break;

    case"cwg_ConversationWin":whotostyle = iddocument.getElementById('cwg_selected_element').innerHTML =

    name[id];Dom.setStyle("TextBoxStyleDiv", "display", "block");Dom.setStyle("textStyleDiv", "display", "none");break;

    case"cwg_MessageWin":whotostyle = iddocument.getElementById('cwg_selected_element').innerHTML =

    name[id];Dom.setStyle("TextBoxStyleDiv", "display", "block");Dom.setStyle("textStyleDiv", "display", "none");break;

    case"addStyleHostName":whotostyle = iddocument.getElementById('cwg_selected_element').innerHTML =

    name[id];break;

    case"addStyleHostConversation":

    whotostyle = iddocument.getElementById('cwg_selected_element').innerHTML =

    name[id];

    break;case"addStyleVisitorName":

    whotostyle = iddocument.getElementById('cwg_selected_element').innerHTML =

    name[id];

    break;case"addStyleVisitorConversation":

    whotostyle = iddocument.getElementById('cwg_selected_element').innerHTML =

    name[id];

    break;case"cwg_languages_box_wrap":

    var languagebox = Dom.getFirstChild(id);whotostyle = languagebox.id

  • 8/3/2019 Var Windows

    11/91

    document.getElementById('cwg_selected_element').innerHTML =name[languagebox.id];

    break;default:

    returnfalse;break;

    }

    }function trans() {/*var disp= document.getElementById('chosencolor');if(disp.style.display=='none'){disp.style.display='block';}else{disp.style.display='none';}*/}function ApplyStyle() {

    if (whotostyle !== undefined && whotostyle !== "") {if (whotostyle === "cwg_MessageWin" || whotostyle ===

    "cwg_ConversationWin") {var transparent_ = Dom.get("Transparent")if (transparent_.checked) {

    Dom.setStyle(whotostyle, 'background-color', "Transparent");} else {

    var backgroundColor =$get("chosencolor").style.backgroundColor;

    Dom.setStyle(whotostyle, 'background-color',backgroundColor);

    }} else {

    var fontsize =$get("fontsize").options[$get("fontsize").selectedIndex].value;

    var fontfamily =$get("fontpicker").options[$get("fontpicker").selectedIndex].value;

    Dom.setStyle(whotostyle, 'font-size', fontsize);Dom.setStyle(whotostyle, 'font-family', fontfamily);var color = $get("chosencolor").style.backgroundColor;Dom.setStyle(whotostyle, 'color', color);

    }}

    }function showStylingDiv(divId) {

    document.getElementById(divId).style.display = 'block';}function hideStylingDiv(divId) {

    document.getElementById(divId).style.display = 'none';

    }

    function placeVCC() {

    var dd;if (Dom.get("convspan") === null) {

    var oNewP = document.createElement("div");var convwraper = document.createElement("div");

  • 8/3/2019 Var Windows

    12/91

    convwraper.id = "convwraper";oNewP.id = "convspan";

    createStyleDiv("addstylediv", convwraper, "Style");var oText = document.createTextNode("View Complete Conversation");Dom.setStyle(oNewP, 'padding', '2px');oNewP.appendChild(oText);convwraper.appendChild(oNewP);Dom.get("cwg_chatDiv").appendChild(convwraper);

    Dom.setX(convwraper, '400');Dom.setY(convwraper, '132');

    Dom.setStyle(oNewP, 'font-size', 'x-small');

    whotostyle = "convspan";

    dd = new YAHOO.util.DD('convwraper');dd.on('dragEvent', function() {

    currentSelectedElement = this.getDragEl();

    elementCurrentPosition("View Complete Conversation");

    });

    } else {whotostyle = "convspan";Dom.get("cwg_chatDiv").removeChild(Dom.get("convwraper"));Dom.setStyle("stylingdiv", "display", "none");

    }//resize[fadeInID].set("draggable", false);

    }function placeLiveHost() {

    var dd;if (Dom.get("cwin_username") === null) {

    var oNewP = document.createElement("div");var livehostwraper = document.createElement("div");livehostwraper.id = "livehostwraper";

    createStyleDiv("addstyledivlivehost", livehostwraper, "Style");

    oNewP.id = "cwin_username";Dom.setStyle(oNewP, 'padding', '2px');var oText = document.createTextNode("Host Name");oNewP.appendChild(oText);

    livehostwraper.appendChild(oNewP);

    Dom.get("cwg_chatDiv").appendChild(livehostwraper);Dom.setStyle(oNewP, 'font-size', 'x-small');whotostyle = "cwin_username";

  • 8/3/2019 Var Windows

    13/91

    Dom.setX(livehostwraper, '300');Dom.setY(livehostwraper, '140');dd = new YAHOO.util.DD('livehostwraper');dd.on('dragEvent', function() {

    currentSelectedElement = this.getDragEl();elementCurrentPosition("Live Host Name");

    });} else {

    Dom.get("cwg_chatDiv").removeChild(Dom.get("livehostwraper"));whotostyle = "cwin_username";Dom.setStyle("stylingdiv", "display", "none");

    }}function placeLabel() {

    var dd;if (Dom.get("any_Label") === null) {

    Dom.setStyle("any_Labeldiv", "display", "block");

    document.getElementById("txtany_Label").value = "Powered By Label";var oNewP = document.createElement("div");Dom.setStyle(oNewP, 'padding', '2px');var labelwraper = document.createElement("div");labelwraper.id = "labelwraper";createStyleDiv("addstyledivlabel", labelwraper, "Style");oNewP.id = "any_Label";

    var oText = document.createTextNode("Powered By Label");

    oNewP.appendChild(oText);

    labelwraper.appendChild(oNewP);

    Dom.get("cwg_chatDiv").appendChild(labelwraper);Dom.setStyle(oNewP, 'font-size', 'x-small');whotostyle = "any_Label";Dom.setX(labelwraper, '420');Dom.setY(labelwraper, '380');dd = new YAHOO.util.DD('labelwraper');dd.on('dragEvent', function() {

    currentSelectedElement = this.getDragEl();elementCurrentPosition("Powered By Label");

    });} else {

    Dom.setStyle("any_Labeldiv", "display", "none");

    Dom.get("cwg_chatDiv").removeChild(Dom.get("labelwraper"));whotostyle = "any_Label";Dom.setStyle("stylingdiv", "display", "none");

    }}function displayEmoticons() {

    var element = document.getElementById("emoticonDiv");if (element.style.display === 'none') {

    element.style.display = 'block';Dom.setX("emoticonDiv", Dom.getX("emoticon"));

  • 8/3/2019 Var Windows

    14/91

    Dom.setY("emoticonDiv", Dom.getY("emoticon") + 30);

    } else {element.style.display = 'none';

    }}/* function SelectEmoticon(){document.getElementById("cwg_MessageWin").innerHTML+="";document.getElementById("emoticonDiv").style.display='none';}*/function placeEmoticons() {

    var dd;if (Dom.get("emoticon") === null) {

    var smileylogo = document.createElement("div");Dom.setStyle(smileylogo, 'padding', '2px');smileylogo.id = "emoticon";smileylogo.onclick = displayEmoticons;

    Dom.get("cwg_chatDiv").appendChild(smileylogo);

    Dom.setStyle(smileylogo, 'background-image','url(emoticons/30.gif)');

    Dom.setStyle(smileylogo, 'background-color', 'Transparent');Dom.setStyle(smileylogo, 'background-repeat', 'no-repeat');Dom.setStyle(smileylogo, 'z-index', '10000');Dom.setStyle(smileylogo, 'border', '#c0c0c0 1px inset');Dom.setStyle(smileylogo, 'height', '24px');Dom.setStyle(smileylogo, 'width', '24px');

    Dom.setX(smileylogo, '420');Dom.setY(smileylogo, '100');

    dd = new YAHOO.util.DD('emoticon');dd.on('dragEvent', function() {

    currentSelectedElement = this.getDragEl();elementCurrentPosition("Smileys");

    });

    var emodiv = document.createElement("div");

    Dom.setStyle(emodiv, 'display', 'none');Dom.setStyle(emodiv, 'padding', '2px');Dom.setStyle(emodiv, 'height', '150px');Dom.setStyle(emodiv, 'width', '128px');Dom.setStyle(emodiv, 'background-color', 'Transparent');

    Dom.setStyle(emodiv, 'border', '#c0c0c0 1px inset');Dom.setStyle(emodiv, 'position', 'absolute');emodiv.id = "emoticonDiv";var count;for (count = 1; count

  • 8/3/2019 Var Windows

    15/91

    smiley.style.zIndex = 90000;emodiv.appendChild(smiley);

    }document.getElementById("cwg_chatDiv").appendChild(emodiv);

    // Event.delegate(emodiv, "click", SelectEmoticon,"img");

    }

    else {

    Dom.get("cwg_chatDiv").removeChild(Dom.get("emoticon"));if (Dom.get("emoticonDiv") !== null) {

    Dom.get("cwg_chatDiv").removeChild(Dom.get("emoticonDiv"));}

    }}function deSelectElement() {

    if (this.id !== 'emoticon' && this.id !== 'chosencolor' && this.id !==

    'stylingdiv' && this.id !== 'emoticonDiv' &&document.getElementById("emoticonDiv") !== null) {

    document.getElementById("emoticonDiv").style.display = 'none';document.getElementById("colorpicker").style.display = 'none';

    }}function placeLogo() {

    var logo;var check = document.getElementById("logo");if (!check) {

    logo = new Image();logo.id = "logo";logo.src = "images/logo.png";Dom.get('cwg_chatDiv').appendChild(logo);

    resiz['logo'] = new YAHOO.util.Resize('logo', {handles: ['r', 'b', 'br'],proxy: true,ghost: true,hover: true,autoRatio: true,draggable: true,status: true,minWidth: 10,minHeight: 10

    });

    createUploadDiv("logoUpload", Dom.getAncestorBy(logo, false),"Upload");

    } else {

    var button = Dom.get("logo");resiz["logo"].destroy();button.parentNode.removeChild(button);

    }

  • 8/3/2019 Var Windows

    16/91

    }

    function placeAd() {debugger;var ad;var cpyDIV = null;var check = document.getElementById("ad");if (!check) {

    ad = document.createElement("div");ad.id = "ad";ad.style.backgroundImage = "url('images/logo.png')";ad.style.width = '87px';ad.style.height = '59px';//ad.setAttribute('style', 'display:none;');//cpyDIV = ad;//ad.setAttribute("style", "opacity: 0.75;-ms-filter: 'alpha

    (opacity=75)';filter: alpha (opacity=75)");//Dom.setStyle("ad", "opacity", "0");Dom.get('cwg_chatDiv').appendChild(ad);

    resiz['ad'] = new YAHOO.util.Resize('ad', {handles: ['r', 'b', 'br'],proxy: true,ghost: true,hover: true,autoRatio: true,draggable: true,status: true,minWidth: 10,minHeight: 10

    });//ad.setAttribute("style", "opacity: 0.6; filter:

    alpha(opacity=60)");//createAdDiv("adanimate", cpyDIV, "Ad Animation");createAdDiv("adanimate", ad, "Ad Animation");

    } else {debugger;var button = Dom.get("ad");resiz["ad"].destroy();button.parentNode.removeChild(button);

    }}

    function placeLanguageBox() {var check = document.getElementById("cwg_languages_box");if (!check) {

    var currentLanguage = document.createElement("div");currentLanguage.id = "cwg_languages_box";currentLanguage.innerHTML = "Select Language";currentLanguage.style.position = "relative";currentLanguage.style.left = "177px";currentLanguage.style.top = "66px";currentLanguage.style.width = "128px";currentLanguage.style.height = "20px";currentLanguage.style.paddingTop = "5px";

  • 8/3/2019 Var Windows

    17/91

    currentLanguage.style.paddingLeft = "5px";currentLanguage.style.color = "#000";currentLanguage.style.backgroundColor = "#ffffff";currentLanguage.style.backgroundImage = "url('images/arrow-

    down.png')";currentLanguage.style.backgroundPosition = 'right';currentLanguage.style.backgroundRepeat = 'no-repeat';currentLanguage.style.border = 'solid 1px gray';currentLanguage.style.cursor = "pointer";currentLanguage.style.textAlign = 'left';currentLanguage.style.fontFamily = 'arial';currentLanguage.style.fontSize = '12px';

    document.getElementById('cwg_chatDiv').appendChild(currentLanguage);

    resiz['cwg_languages_box'] = newYAHOO.util.Resize('cwg_languages_box', {

    handles: ['r', 'b', 'br'],proxy: true,ghost: true,

    hover: true,autoRatio: true,draggable: true,status: true,minWidth: 10,minHeight: 10

    });//

    createStyleDiv("cwg_languages_boxStyle",Dom.getAncestorBy(currentLanguage,false),"Style");

    } else {var button = Dom.get("cwg_languages_box");

    resiz["cwg_languages_box"].destroy();button.parentNode.removeChild(button);

    }

    }

    function setLabelText() {document.getElementById("any_Label").innerHTML =

    document.getElementById("txtany_Label").value;document.getElementById("txtany_Label").value = "";

    }

    function placeMaximizeButton(source) {

    var ministatus = Dom.get("ministatusdiv");var maximizebutton = Dom.get("maximize");var button = new Image();if (ministatus !== null) {

    if (maximizebutton === null) {

    button.id = "maximize";

  • 8/3/2019 Var Windows

    18/91

    button.src = source;ministatus.appendChild(button);

    Dom.setStyle("maximize", "width", "16px");Dom.setStyle("maximize", "height", "16px");Dom.setStyle("maximize", "padding-top", "6px");var ministatusregion, ministatusWidth;ministatusregion = Dom.getRegion("ministatusdiv");ministatusWidth = ministatusregion.width;ministatusX = Dom.getX("ministatusdiv");if (button)

    Dom.setStyle(button, "padding-left", ministatusWidth - 21 +'px');

    } else {Dom.get("maximize").src = source;

    }

    } else {msgalert("Please place Minimized status

    first");}

    }

    var resiz = new Array();

    // display Button//function placeButton(source, buttonName) {

    var bg = Dom.get("cwg_chatDiv");var button = Dom.get(buttonName);

    if (!button) {

    if (buttonName === "ministatusdiv" || buttonName === "offlinebutton"|| buttonName === "onlinebutton") {

    button = document.createElement('div');button.id = buttonName;button.style.backgroundImage = "url('" + source + "')";button.style.backgroundRepeat = "no-repeat";

    $get("MainPanel").appendChild(button);Dom.setX(button, "650");

    Dom.setStyle(button, "margin-bottom", '20px');

    var newImg = new Image();newImg.src = source;var imgHeight = newImg.height ? newImg.height :

    newImg.style.height;var imgWidth = newImg.width ? newImg.width : newImg.style.width;

    Dom.setStyle(buttonName, "height", imgHeight + 'px');Dom.setStyle(buttonName, "width", imgWidth + 'px');

  • 8/3/2019 Var Windows

    19/91

    resiz[button.id] = new YAHOO.util.Resize(button.id, {handles: ['r', 'b', 'br'],proxy: true,ghost: true,hover: true,autoRatio: true,draggable: true,status: true,minWidth: 10,minHeight: 10

    });

    placeMaximizeButton();}else {

    button = new Image();button.id = buttonName;button.src = source;bg.appendChild(button);

    resiz[button.id] = new YAHOO.util.Resize(button.id, {handles: ['r', 'b', 'br'],proxy: true,ghost: true,hover: true,draggable: true,autoRatio: true,status: true,minWidth: 10,minHeight: 10,maxWidth: 150,maxHeight: 150

    });resiz[button.id].on('dragEvent', function() {

    currentSelectedElement = this;elementCurrentPosition(name[button.id]);

    });resiz[button.id].on('resize', function() {

    currentSelectedElement = this;elementCurrentRegion(name[button.id]);

    });

    createUploadDiv(button.id + "upload", Dom.getAncestorBy(button,false), "Upload");

    }switch (buttonName) {

    case"send":var remove = document.createElement('a');remove.innerHTML = " remove";remove.id = "sendremove";remove.setAttribute('href',

    "javascript:remove('send','sendremove')");Dom.get("send-button-head").appendChild(remove);

  • 8/3/2019 Var Windows

    20/91

    break;

    case"visiturl":

    var remove = document.createElement('a');remove.innerHTML = " remove";remove.id = "visiturlremove";remove.setAttribute('href',

    "javascript:remove('visiturl','visiturlremove')");Dom.get("visit-url-head").appendChild(remove);break;

    case"close":var remove = document.createElement('a');remove.innerHTML = " remove";remove.id = "closeremove";remove.setAttribute('href',

    "javascript:remove('close','closeremove')");Dom.get("close-button-head").appendChild(remove);

    break;

    case"minimize":

    var remove = document.createElement('a');remove.innerHTML = " remove";remove.id = "minimizeremove";remove.setAttribute('href',

    "javascript:remove('minimize','minimizeremove')");Dom.get("min-button-head").appendChild(remove);break;

    case"typingstatus":

    var remove = document.createElement('a');remove.innerHTML = " remove";remove.id = "typingstatusremove";remove.setAttribute('href',

    "javascript:remove('typingstatus','typingstatusremove')");Dom.get("typing-status-head").appendChild(remove);break;

    case"ministatusdiv":var remove = document.createElement('a');remove.innerHTML = " remove";remove.id = "ministatusremove";remove.setAttribute('href',

    "javascript:remove('ministatusdiv','ministatusremove')");

    Dom.get("mini-status-head").appendChild(remove);break;

    case"offlinebutton":var remove = document.createElement('a');remove.innerHTML = " remove";remove.id = "offlinebuttonremove";remove.setAttribute('href',

    "javascript:remove('offlinebutton','offlinebuttonremove')");Dom.get("offline-button-head").appendChild(remove);break;

  • 8/3/2019 Var Windows

    21/91

    break;case"onlinebutton":

    var remove = document.createElement('a');remove.innerHTML = " remove";remove.id = "onlinebuttonremove";remove.setAttribute('href',

    "javascript:remove('onlinebutton','onlinebuttonremove')");Dom.get("online-button-head").appendChild(remove);break;

    default:msgalert("some unknown

    button");}

    } else {

    resiz[button.id].destroy();if (button.id === "ministatusdiv") {

    button.style.backgroundImage = "url('" + source + "')";

    } else {button.src = source;

    }

    resiz[button.id] = new YAHOO.util.Resize(button.id, {handles: ['r', 'b', 'br'],proxy: true,ghost: true,hover: true,draggable: true,autoRatio: true,status: true,minWidth: 10,minHeight: 10,maxHeight: 150

    });createUploadDiv(button.id + "upload", Dom.getAncestorBy(button,

    false), "Upload");resiz[button.id].on('dragEvent', function() {

    currentSelectedElement = this;elementCurrentPosition(name[button.id]);

    });resiz[button.id].on('resize', function() {

    currentSelectedElement = this;elementCurrentRegion(name[button.id]);

    });

    }}function remove(button, remove) {

    var button = Dom.get(button);resiz[button.id].destroy();

    button.parentNode.removeChild(button);

    var removebtn = Dom.get(remove);

  • 8/3/2019 Var Windows

    22/91

    removebtn.parentNode.removeChild(removebtn);}// Get the selected Position of windowfunction getposition_window() {

    var positioning = "";var position = Dom.getElementsByClassName('selectedposition');var position_id = Dom.getAttribute(position, 'id').toString();var precizex = document.getElementById("x_pos").value;var precizey = document.getElementById("y_pos").value;

    if (precizex == "") {precizex == 0;

    }if (precizey == "") {

    precizey = 0;}

    switch (position_id) {

    case"top-left":

    positioning = "positioning(0, 0, " + precizex + "," + precizey +");";

    break;case"top-middle":

    positioning = "positioning(1, 0, " + precizex + "," + precizey +");";

    break;case"top-right":

    positioning = "positioning(3, 0," + precizex + "," + precizey +");";

    break;

    case"middle-left":positioning = " positioning(0, 1," + precizex + "," + precizey +

    ");";break;

    case"middle-middle":positioning = " positioning(1, 1," + precizex + "," + precizey +

    ");";break;

    case"middle-right":positioning = " positioning(3, 1," + precizex + "," + precizey +

    ");";break;

    case"bottom-left":positioning = " positioning(0, 3," + precizex + "," + precizey +

    ");";break;

    case"bottom-middle":positioning = " positioning(1, 3," + precizex + "," + precizey +

    ");";break;

    case"bottom-right":

  • 8/3/2019 Var Windows

    23/91

    positioning = " positioning(3, 3," + precizex + "," + precizey +");";

    break;

    default:msgalert("Unknown Position");

    }

    return positioning += "Dom.setStyle('ChatDiv', 'display', 'none');";

    }// Generate the code for windowfunction GenCode() {

    var positioning = "function positioning(boxhorizontal, boxvertical,precize_x, precize_y) {Dom.setStyle('ChatDiv', 'position', 'absolute');varwidth = Dom.getStyle('ChatDiv', 'width');var chatdivwidth =

    width.substring(0, width.length - 2);var height = Dom.getStyle('ChatDiv','height');var chatdivheight = height.substring(0, height.length - 2);if(boxhorizontal == 1 || boxhorizontal == 0) {chatdivwidth = 0;}if (boxvertical== 1 || boxvertical == 0) {chatdivheight = 0;}posX =Math.round(Dom.getViewportWidth() / 3 * boxhorizontal) - chatdivwidth %2Bprecize_x;posY = Math.round(Dom.getViewportHeight() / 3 * boxvertical) -chatdivheight %2B precize_y;Dom.setX('ChatDiv', posX);Dom.setY('ChatDiv',posY);}";

    var positioning_function_call = getposition_window();var IsMaximize;

    var src = Dom.getAttribute('maximize', 'src');

    if (src == false) {IsMaximize = false;

    } elseif (src == "") {IsMaximize = false;

    } elseif (src !== "" && src !== "undefined") {IsMaximize = true;

    } elseif (src == "undefined") {IsMaximize = false;

    }

    /*if (Dom.getStyle("cwg_ConversationWin", "opacity") == 1 &&Dom.getStyle("cwg_MessageWin", "opacity") == 1 && Dom.get('send') &&Dom.get('visiturl') && Dom.get('close') && Dom.get('minimize') &&

    Dom.get('ministatusdiv') && IsMaximize && Dom.get('convspan')) {*/

    var backwidth, backheight, conheight, conwidth, msgheight, msgwidth,sendwidth, sendheight, urlwidth, urlheight, closeheight, closewidth,minimizeheight, minimizewidth, typingwidth, typingheight, ministatusx,ministatusy, ministatusheight, ministatuswidth;

    backheight = Dom.getStyle("cwg_chatDiv", "height");backwidth = Dom.getStyle("cwg_chatDiv", "width");

  • 8/3/2019 Var Windows

    24/91

    conheight = Dom.getStyle("cwg_ConversationWin", "height"); //- 5;conwidth = Dom.getStyle("cwg_ConversationWin", "width"); //- 5;

    msgheight = Dom.getStyle("cwg_MessageWin", "height"); //- 5;msgwidth = Dom.getStyle("cwg_MessageWin", "width"); //- 5;

    //style codevar bg = Dom.getStyle("cwg_chatDiv", "backgroundImage");

    var HTMLEL, BasicHTMLEL;// Generate HTML Code //// BasicHTMLEL = "var ChatDiv =

    document.createElement('div');ChatDiv.id ='ChatDiv';document.body.appendChild(ChatDiv);Dom.setStyle ( 'ChatDiv' ,'backgroundImage' ,'" + bg + "' );Dom.setStyle ( 'ChatDiv' ,'backgroundRepeat' ,'no-repeat' );var ConvWraper =document.createElement('div');ConvWraper.id ='ConvWraper';Dom.get('ChatDiv').appendChild(ConvWraper);var txtChatWin=document.createElement('textarea');txtChatWin.id ='txtChatWin';txtChatWin.readOnly

    =true;Dom.get('ConvWraper').appendChild(txtChatWin);var MsgWraper =document.createElement('div');MsgWraper.id ='MsgWraper';Dom.get('ChatDiv').appendChild(MsgWraper);var txtMessageWin=document.createElement('textarea');txtMessageWin.id ='txtMessageWin';Dom.get('MsgWraper').appendChild(txtMessageWin);";

    BasicHTMLEL = "var ChatDiv = document.createElement('div');ChatDiv.id ='ChatDiv';document.body.appendChild(ChatDiv);Dom.setStyle ( 'ChatDiv' ,'backgroundImage' ,'" + bg + "' );Dom.setStyle ( 'ChatDiv' ,'backgroundRepeat' ,'no-repeat' );var txtChatWin=document.createElement('textarea');Dom.setStyle(txtChatWin,'backgroundColor','" + Dom.getStyle('cwg_ConversationWin', 'backgroundColor') +"');txtChatWin.id = 'txtChatWin';txtChatWin.readOnly=true;Dom.get('ChatDiv').appendChild(txtChatWin);var txtMessageWin=document.createElement('textarea');txtMessageWin.id ='txtMessageWin';Dom.get('ChatDiv').appendChild(txtMessageWin);Dom.setStyle(txtMessageWin,'backgroundColor','" + Dom.getStyle('cwg_MessageWin','backgroundColor') + "');";

    var backx, backy, conx, cony, msgx, msgy, sendx, sendy, urlx, urly,closex, closey, minimizex, minimizey, typingx, typingy, sendbtn, urlbtn,closebtn, minimizebtn, typingstatusbtn, ministatus;

    backx = Dom.getStyle("cwg_chatDiv", "left");backy = Dom.getStyle("cwg_chatDiv", "top");conx = Dom.getStyle("cwg_ConversationWin", "left");

    cony = Dom.getStyle("cwg_ConversationWin", "top");msgx = Dom.getStyle("cwg_MessageWin", "left");msgy = Dom.getStyle("cwg_MessageWin", "top");

    sendbtn = Dom.get("send");urlbtn = Dom.get("visiturl");closebtn = Dom.get("close");minimizebtn = Dom.get("minimize");typingstatusbtn = Dom.get("typingstatus");

  • 8/3/2019 Var Windows

    25/91

    ministatus = Dom.get("ministatusdiv");

    var sendattrib, urlattrib, closeattrib, minimizeattrib, typingattrib,ministatusattrib, viewconvattrib, cwin_usernameattrib, anylabelattrib,messageWindowattrib, chatWindowattrib, logoattrib;

    var sendel, urlel, closeel, minimizeel, typingel, miniel, viewconvel,cwin_usernameel, anylabelel, logoel;

    if (sendbtn !== null) {

    sendx = Dom.getStyle("send_wrap", "left");sendy = Dom.getStyle("send_wrap", "top");

    sendheight = Dom.getRegion("send").height;sendwidth = Dom.getRegion("send").width;// Dynamic Style//sendattrib = "Dom.setStyle ( 'btnSend' , 'width' , '" + sendwidth +

    "px' );Dom.setStyle ( 'btnSend' , 'height' ,'" + sendheight + "px');Dom.setStyle('btnSend','left','" + sendx +"');Dom.setStyle('btnSend','top','" + sendy +

    "');Dom.setStyle('btnSend','cursor','pointer');Dom.setStyle('btnSend','position','absolute');";

    //Dynamic HTML//sendel = "var btnSend= document.createElement('img');btnSend.id =

    'btnSend';btnSend.src='" + Dom.getAttribute('send', 'src') +"';Dom.get('ChatDiv').appendChild(btnSend);YAHOO.util.Event.addListener('btnSend', 'mouseover', changeimage);YAHOO.util.Event.addListener('btnSend','mouseout', changedefaultimage);";

    } else {

    sendattrib = "";

    sendel = "";}

    if (urlbtn !== null) {urlx = Dom.getStyle("visiturl_wrap", "left");urly = Dom.getStyle("visiturl_wrap", "top");urlheight = Dom.getRegion("visiturl").height;urlwidth = Dom.getRegion("visiturl").width;

    //Dynamic Style//urlattrib = "Dom.setStyle ( 'btnURL' , 'width' , '" + urlwidth + "px'

    );Dom.setStyle ( 'btnURL' , 'height' , '" + urlheight + "px');Dom.setStyle('btnURL','left','" + urlx + "');Dom.setStyle('btnURL','top','"+ urly +"');Dom.setStyle('btnURL','cursor','pointer');Dom.setStyle('btnURL','position','absolute');";

    //Dynamic HTML//urlel = "var btnURL= document.createElement('img');btnURL.id =

    'btnURL';btnURL.src='" + Dom.getAttribute('visiturl', 'src') +"';Dom.get('ChatDiv').appendChild(btnURL);YAHOO.util.Event.addListener('btnUR

  • 8/3/2019 Var Windows

    26/91

    L', 'mouseover', changeimage);YAHOO.util.Event.addListener('btnURL','mouseout', changedefaultimage);";

    } else {

    urlattrib = "";urlel = "";

    }

    if (closebtn !== null) {closex = Dom.getStyle("close_wrap", "left");closey = Dom.getStyle("close_wrap", "top");closeheight = Dom.getRegion("close").height;closewidth = Dom.getRegion("close").width;

    // Dynamic Style//closeattrib = "Dom.setStyle ( 'closeBTN' , 'width' , '" + closewidth

    + "px' );Dom.setStyle ( 'closeBTN' , 'height' , '" + closeheight + "px');Dom.setStyle('closeBTN','left','" + closex +"');Dom.setStyle('closeBTN','top','" + closey +

    "');Dom.setStyle('closeBTN','position','absolute');";// Dynamic HTML//closeel = "var closeBTN= document.createElement('img');closeBTN.id =

    'closeBTN';closeBTN.src='" + Dom.getAttribute('close', 'src') +"';Dom.get('ChatDiv').appendChild(closeBTN);YAHOO.util.Event.addListener('closeBTN', 'mouseover', changeimage);YAHOO.util.Event.addListener('closeBTN','mouseout', changedefaultimage);";

    } else {

    closeattrib = "";

    closeel = "";}

    if (minimizebtn !== null) {minimizex = Dom.getStyle("minimize_wrap", "left");minimizey = Dom.getStyle("minimize_wrap", "top");minimizeheight = Dom.getRegion("minimize").height;minimizewidth = Dom.getRegion("minimize").width;// Dynamic Style //minimizeattrib = "Dom.setStyle ( 'minBTN' , 'width' , '" +

    minimizewidth + "px' );Dom.setStyle ( 'minBTN' , 'height' , '" +minimizeheight + "px' );Dom.setStyle('minBTN','left','" + minimizex +"');Dom.setStyle('minBTN','top','" + minimizey +

    "');Dom.setStyle('minBTN','position','absolute');";// Dynamic HTML //minimizeel = "var minBTN= document.createElement('img');minBTN.id =

    'minBTN';minBTN.src='" + Dom.getAttribute('minimize', 'src') +"';Dom.get('ChatDiv').appendChild(minBTN);YAHOO.util.Event.addListener('minBTN', 'mouseover', changeimage);YAHOO.util.Event.addListener('minBTN','mouseout', changedefaultimage);";

    } else {

  • 8/3/2019 Var Windows

    27/91

    minimizeattrib = "";

    minimizeel = "";}

    if (typingstatusbtn !== null) {typingx = Dom.getStyle("typingstatus_wrap", "left");typingy = Dom.getStyle("typingstatus_wrap", "top");typingheight = Dom.getRegion("typingstatus").height;typingwidth = Dom.getRegion("typingstatus").width;

    // Dynamic Style //typingattrib = "Dom.setStyle ( 'typingstatus' , 'width' , '" +

    typingwidth + "px' );Dom.setStyle ( 'typingstatus' , 'height' , '" +typingheight + "px' );Dom.setStyle('typingstatus','left','" + typingx +"');Dom.setStyle('typingstatus','top','" + typingy +"');Dom.setStyle('typingstatus','visibility','hidden');Dom.setStyle('typingstatus','position','absolute');";

    // Dynamic HTML //

    typingel = "var typingstatus=document.createElement('img');typingstatus.id ='typingstatus';typingstatus.src='" + Dom.getAttribute('typingstatus', 'src')+ "';Dom.get('ChatDiv').appendChild(typingstatus);";

    } else {

    typingattrib = "";

    typingel = "";}

    if (ministatus !== null) {ministatusx = Dom.getX("ministatusdiv");ministatusy = Dom.getY("ministatusdiv");ministatusheight = Dom.getRegion("ministatusdiv").height;ministatuswidth = Dom.getRegion("ministatusdiv").width;

    // Dynamic Style //ministatusattrib = "Dom.setStyle ( 'minDiv' , 'width' , '" +

    ministatuswidth + "px' );Dom.setStyle ( 'minDiv' , 'height' , '" +ministatusheight + "px' );";

    // Dynamic HTML //fadein = "var mindivattributes = { opacity: { from: 0, to: 1} };var

    animmindiv = new YAHOO.util.Anim('ChatDiv',

    mindivattributes);animmindiv.animate();Dom.setStyle ( 'ChatDiv' , 'display' ,'block' );"

    miniel = "var minDiv = document.createElement('div');minDiv.id ='minDiv';minDiv.style.backgroundRepeat='no-repeat';minDiv.style.backgroundImage='" + Dom.getStyle('ministatusdiv','background-image') + "';document.body.appendChild(minDiv);var ministatus=document.createElement('img');ministatus.id = 'ministatus';ministatus.src='"+ Dom.getAttribute('maximize', 'src') +"';Dom.get('minDiv').appendChild(ministatus);Dom.setStyle('ministatus','width', '16px');Dom.setStyle('ministatus', 'height',

  • 8/3/2019 Var Windows

    28/91

    '16px');Dom.setStyle('ministatus', 'margin-top','6px');Dom.setStyle('ministatus', 'margin-left', '" +Dom.getStyle('maximize', 'padding-left') +"');Dom.setStyle('minDiv','display','none');YAHOO.util.Event.addListener('ministatus', 'click', displayWindow);function displayWindow(){Dom.setStyle ('minDiv' , 'display' , 'none' );" + fadein +"}YAHOO.util.Event.addListener('ministatus', 'mouseover',changeimage);YAHOO.util.Event.addListener('ministatus', 'mouseout',changedefaultimage);";

    } else {ministatusattrib = "";miniel = "";

    }

    if (Dom.get("convspan") !== null) {var convX = Dom.getStyle('convwraper', 'left');var convY = Dom.getStyle('convwraper', 'top');

    viewconvattrib = "Dom.setStyle ( 'convspan' , 'width' , '160px'

    );Dom.setStyle('convspan','left', '" + convX +"');Dom.setStyle('convspan','top' ,'" + convY +"');Dom.setStyle('convspan','position','absolute');";

    viewconvel = "var oNewP =document.createElement('div');oNewP.setAttribute('id', 'convspan');var oText= document.createElement('a');oText.innerHTML='View CompleteConversation';oText.id ='conversationDIV';oNewP.appendChild(oText);Dom.setStyle('conversationDIV','display','none');Dom.get('ChatDiv').appendChild(oNewP);Dom.setStyle('conversationDIV', 'font-size', '" + Dom.getStyle('convspan', 'font-size') +"');Dom.setStyle('conversationDIV', 'color', '" + Dom.getStyle('convspan','color') + "');Dom.setStyle('conversationDIV', 'font-family', '" +Dom.getStyle('convspan', 'font-family') +"');Dom.setStyle('convspan','cursor','pointer');Dom.setStyle('conversationDIV','cursor','pointer');" + viewconvattrib;

    } else {viewconvel = "";

    }if (Dom.get("cwin_username") !== null) {

    var userNameX = Dom.getStyle('livehostwraper', 'left');var userNameY = Dom.getStyle('livehostwraper', 'top');

    cwin_usernameattrib = "Dom.setStyle ( 'cwin_username' , 'width' ,'70px' );Dom.setStyle('cwin_username','left', '" + userNameX +"');Dom.setStyle('cwin_username','top','" + userNameY +"');Dom.setStyle('cwin_username','position','absolute');";

    cwin_usernameel = "var oNewP =

    document.createElement('div');oNewP.setAttribute('id', 'cwin_username');varoText = document.createTextNode('HostName');oNewP.appendChild(oText);oNewP.appendChild(oText);Dom.get('ChatDiv').appendChild(oNewP);Dom.setStyle('cwin_username', 'font-size', '" +Dom.getStyle('cwin_username', 'font-size') +"');Dom.setStyle('cwin_username', 'color', '" + Dom.getStyle('cwin_username','color') + "');Dom.setStyle('cwin_username', 'font-family', '" +Dom.getStyle('cwin_username', 'font-family') + "');" + cwin_usernameattrib +"";

    } else {

  • 8/3/2019 Var Windows

    29/91

    cwin_usernameel = "";}if (Dom.get("any_Label") !== null) {

    var anyLabelX = Dom.getStyle('labelwraper', 'left');var anyLabelY = Dom.getStyle('labelwraper', 'top');anylabelattrib = "Dom.setStyle('any_Labelspan','left','" + anyLabelX

    + "');Dom.setStyle('any_Labelspan','top', '" + anyLabelY +"');Dom.setStyle('any_Labelspan','position','absolute');";

    anylabelel = "var any_Labelspan =document.createElement('span');any_Labelspan.setAttribute('id','any_Labelspan');any_Labelspan.innerHTML='" +document.getElementById("any_Label").innerHTML +"';Dom.get('ChatDiv').appendChild(any_Labelspan);Dom.setStyle('any_Labelspan', 'font-size', '" + Dom.getStyle('any_Label', 'font-size') +"');Dom.setStyle('any_Labelspan', 'color', '" + Dom.getStyle('any_Label','color') + "');Dom.setStyle('any_Labelspan', 'font-family', '" +Dom.getStyle('any_Label', 'font-family') + "');" + anylabelattrib;

    } else {anylabelel = "";

    }

    if (Dom.get("logo") !== null) {var logoX = Dom.getStyle('logo_wrap', 'left');var logoY = Dom.getStyle('logo_wrap', 'top');var logoWidth = Dom.getStyle('logo', 'width');var logoHeight = Dom.getStyle('logo', 'height');logoattrib = "Dom.setStyle('cwg_logo','height','" + logoHeight +

    "');Dom.setStyle('cwg_logo','width','" + logoWidth +"');Dom.setStyle('cwg_logo','left','" + logoX +"');Dom.setStyle('cwg_logo','top', '" + logoY +"');Dom.setStyle('cwg_logo','position','absolute');";

    logoel = "var cwg_logo =document.createElement('img');cwg_logo.setAttribute('id','cwg_logo');cwg_logo.src='" + document.getElementById("logo").src +"';Dom.get('ChatDiv').appendChild(cwg_logo);" + logoattrib;

    } else {logoel = "";

    }

    if (Dom.get("ad") !== null) {var adX = Dom.getStyle('ad', 'left');var adY = Dom.getStyle('ad', 'top');var adWidth = Dom.getStyle('ad', 'width');var adHeight = Dom.getStyle('ad', 'height');

    var cwg_ad_images = "";var imagesforAnimation = Dom.getElementsByClassName("animationText"),

    allImages = true;for (var i = 0; i

  • 8/3/2019 Var Windows

    30/91

    "');Dom.setStyle('cwg_ad','position','absolute');Dom.setStyle('cwg_ad','background-repeat','no-repeat');";

    var addd = "var cwg_ad =document.createElement('div');cwg_ad.setAttribute('id','cwg_ad');Dom.get('ChatDiv').appendChild(cwg_ad);" + adattrib;

    adel = addd + "if(Dom.get('cwg_ad') !== null){banners('" +cwg_ad_images + "','" + animInterval.value * 1000 + "')}";

    } else {adel = "";

    }

    if (Dom.get("cwg_languages_box") !== null) {var cwg_languages_boxX = Dom.getStyle('cwg_languages_box', 'left');var cwg_languages_boxY = Dom.getStyle('cwg_languages_box', 'top');var cwg_languages_boxWidth = Dom.getStyle('cwg_languages_box',

    'width');var cwg_languages_boxHeight = Dom.getStyle('cwg_languages_box',

    'height');cwg_languages_boxattrib =

    "Dom.setStyle('cwg_languages_box','height','" + cwg_languages_boxHeight +"');Dom.setStyle('cwg_languages_box','width','" + cwg_languages_boxWidth +"');Dom.setStyle('cwg_languages_box','left','" + cwg_languages_boxX +"');Dom.setStyle('cwg_languages_box','top', '" + cwg_languages_boxY +"');Dom.setStyle('cwg_languages_box','position','absolute');";

    cwg_languages_boxel = "var cwg_languages_box =document.createElement('div');cwg_languages_box.innerHTML='SelectLanguage';cwg_languages_box.setAttribute('id','cwg_languages_box');Dom.get('ChatDiv').appendChild(cwg_languages_box);Dom.setStyle('cwg_languages_box','backgroundColor','White');Dom.setStyle('cwg_languages_box','backgroundImage','url(../images/arrow-down.png)');Dom.setStyle('cwg_languages_box','backgroundPosition','rightcenter'); Dom.setStyle('cwg_languages_box','backgroundRepeat','no-repeat');Dom.setStyle('cwg_languages_box','border','1px solid gray');Dom.setStyle('cwg_languages_box','color','gray');Dom.setStyle('cwg_languages_box','cursor','pointer');Dom.setStyle('cwg_languages_box','font-size','12px');Dom.setStyle('cwg_languages_box','padding-top','1px');Dom.setStyle('cwg_languages_box','text-align','center');Dom.setStyle('cwg_languages_box','fontFamily','arial'); " +cwg_languages_boxattrib;

    } else {cwg_languages_boxel = "";

    }

    //Dynamic HTML //

    HTMLEL = BasicHTMLEL + sendel + urlel + closeel + minimizeel + typingel;

    // Features//

    var openminidiv;

  • 8/3/2019 Var Windows

    31/91

    if (ministatus !== null) {openminidiv = "Dom.setStyle ( 'minDiv' , 'display' , 'block' );";

    } else {openminidiv = "";

    }

    var dragable, fademin;if (Dom.get("Dragable").checked) {

    var ddminidiv = "";if (ministatus !== null) {

    ddminidiv = "var ddmini = new YAHOO.util.DD('minDiv');";}

    dragable = "var dd = newYAHOO.util.DD('ChatDiv');dd.addInvalidHandleId('txtChatWin');dd.addInvalidHandleId('btnSend');dd.addInvalidHandleId('btnURL');dd.addInvalidHandleId('txtMessageWin');dd.addInvalidHandleId('txtMessageWin');" + ddminidiv + "";

    }else {

    dragable = "";

    }

    if (Dom.get("fademin").checked) {var fadeout;/* if (document.getElementById("minwipe").checked) {fadeout = "var attributes = { width: {to: 0}, opacity: {to: 0},

    height: {to: 0} };var children=Dom.getChildren('ChatDiv');for(vari=0;i

  • 8/3/2019 Var Windows

    32/91

    }if (Dom.get("checkMessageWindow").checked == false) {

    messageWindowattrib = "Dom.setStyle('txtMessageWin', 'border','0px');Dom.setStyle('txtMessageWin', 'padding', '0px');";

    } else {messageWindowattrib = "";

    }if (Dom.get("checkConversationWindow").checked == false) {

    chatWindowattrib = "Dom.setStyle('txtChatWin', 'border','0px');Dom.setStyle('txtChatWin', 'padding', '0px');";

    } else {chatWindowattrib = "";

    }

    //change the image of buttons //var picchangefunc = escape("var path; function

    changeimage(){path=this.src;var str = new Array(); var name_full = newArray(); str = path.split('/'); var name = str[str.length - 1]; name_full =name.split('.'); var buttonName = name_full[0]; var last = buttonName %2B'_hover.' %2B name_full[1]; var finalstr = ''; for (var i = 0; i < str.length

    - 1; i%2B%2B) { finalstr %2B= str[i] %2B '/'; } this.src = finalstr %2B last;} function changedefaultimage() { this.src = path; }");

    var site = document.getElementById('url').value;

    //Make the Editor////var make_cwg_editor="var myConfig = { height: '180px',width: '280px'};

    myEditor = new YAHOO.widget.SimpleEditor('txtChatWin',myConfig);myEditor.render();myEditor.on('beforeEditorKeyDown', function() {document.getElementById('txtMessageWin').focus();});";

    colors = "var cwg_hostColor='" + Dom.getStyle('addStyleHostName','color') + "';var cwg_visitorColor='" + Dom.getStyle('addStyleVisitorName','color') + "';var cwg_messageColor='" +Dom.getStyle('addStyleVisitorConversation', 'color') + "';varcwg_chatColor='" + Dom.getStyle('addStyleHostConversation', 'color') + "';";

    if (Dom.get("onlinebutton") !== null) {var onlineButtonBG =

    document.getElementById("onlinebutton").style.backgroundImage;var OBBG = onlineButtonBG.substring(4, onlineButtonBG.length - 1);

    }if (Dom.get("offlinebutton") !== null) {

    var offlineButtonBG =document.getElementById("offlinebutton").style.backgroundImage;

    var OFBBG = offlineButtonBG.substring(4, offlineButtonBG.length - 1);}

    //layout codevar layoutcode = "var LC_onlineImg=" + OBBG + ";var LC_offlineImg=" +

    OFBBG + ";" + colors + "var website='" + site + "';var Dom =YAHOO.util.Dom,LC_Event = YAHOO.util.Event;function generateWindow(){varposX,posY;" + HTMLEL + "Dom.setStyle('ChatDiv' , 'width' , '" + backwidth +"' );Dom.setStyle('ChatDiv','position','absolute');Dom.setStyle ( 'ChatDiv' ,'height' ,'" + backheight + "');Dom.setStyle('ChatDiv','zIndex','100000000');Dom.setStyle('ChatDiv','left','" + backx + "');Dom.setStyle('ChatDiv','top','" + backy + "');Dom.setStyle('txtChatWin' , 'padding' , '3px' );Dom.setStyle ('txtChatWin' , 'width' , '"

  • 8/3/2019 Var Windows

    33/91

    + conwidth + "');Dom.setStyle('txtChatWin','position','absolute');Dom.setStyle ('txtChatWin' , 'font-family' , 'sans-serif' );Dom.setStyle ( 'txtChatWin' ,'font-size' , '12px' );Dom.setStyle ( 'txtChatWin' , 'height' , '" +conheight + "' );Dom.setStyle('txtChatWin','left','" + conx +"');Dom.setStyle('txtChatWin','top','" + cony + "');Dom.setStyle ('txtMessageWin' , 'width' , '" + msgwidth + "');Dom.setStyle('txtMessageWin','position','absolute');Dom.setStyle ('txtMessageWin' , 'height' , '" + msgheight + "' );Dom.setStyle ('txtMessageWin' , 'font-family' , 'sans-serif' );Dom.setStyle ('txtMessageWin' , 'font-size' , '12px');Dom.setStyle('txtMessageWin','left','" + msgx +"');Dom.setStyle('txtMessageWin','top','" + msgy + "');" +messageWindowattrib + chatWindowattrib + sendattrib + urlattrib + closeattrib+ minimizeattrib + typingattrib + dragable + fademin + miniel +ministatusattrib + viewconvel + cwin_usernameel + anylabelel + logoel + adel+ cwg_languages_boxel + picchangefunc + positioning +positioning_function_call + "}generateWindow();";

    var postData = layoutcode;

    var handleFailure = function(o) {msgalert(o.responseText);

    }var handleSuccess = function(o) {

    if (o.responseText !== undefined) {// alert(o.responseText);

    var path = o.responseText;

    var answer = window.showModalDialog(path, Math.random(),"center:yes;dialogWidth:1024px; dialogHeight:768px; ");

    }}

    var callback ={

    success: handleSuccess,failure: handleFailure,argument: ['foo', 'bar']

    };

    var data = "Preview.aspx?win=" + postData;var request = YAHOO.util.Connect.asyncRequest('POST', data, callback);

    /* } else {msgalert("Please Place mandatory Items on the

    panel. ie. items with *");}*/

    }

    // on mouse over Animate ////////var big = function(event, matchedEl, containerbg) {

  • 8/3/2019 Var Windows

    34/91

    //debugger;var attributes = { width: { to: 88} };var anim = new YAHOO.util.Anim(matchedEl, attributes, .2);anim.animate();

    };// on mouse out Animate ////////var small = function(event, matchedEl, containerbg) {

    var attributes = { width: { to: 80} };

    var anim = new YAHOO.util.Anim(matchedEl, attributes, .2);anim.animate();

    }

    var setBackground = function() {

    var newImg = new Image();newImg.src = this.src;var curHeight = newImg.height ? newImg.height : newImg.style.height;

    var curWidth = newImg.width ? newImg.width : newImg.style.width;

    Dom.setStyle("cwg_chatDiv", "height", curHeight + 'px');Dom.setStyle("cwg_chatDiv", "width", curWidth + 'px');Dom.setStyle("cwg_chatDiv", "position", "absolute");Dom.setStyle("cwg_chatDiv", "opacity", "0");Dom.setStyle("cwg_chatDiv", "backgroundImage", "url('" + this.src +

    "')");Dom.setStyle("cwg_chatDiv", "backgroundRepeat", "no-repeat");

    createUploadDiv("cwg_chatDiv_upload",document.getElementById('cwg_chatDiv'), "Upload");

    var attributes = { opacity: { from: 0, to: 1} };var conanim = new YAHOO.util.Anim("cwg_ConversationWin", attributes, .5);conanim.animate();var msganim = new YAHOO.util.Anim("cwg_MessageWin", attributes, .5);msganim.animate();var backanim = new YAHOO.util.Anim("cwg_chatDiv", attributes, .5);backanim.animate();

    }

    var setposition = function() {Dom.replaceClass("bottom-right", 'selectedposition', 'position');Dom.replaceClass(Dom.getElementsByClassName('position'),

    'selectedposition', 'position');Dom.addClass(this, 'selectedposition');document.getElementById("window_positioning").innerHTML = this.id;

    }

  • 8/3/2019 Var Windows

    35/91

    var selectElement = function() {var element;

    if (this.id == "cwin_username" || this.id == "convspan" || this.id =="any_Label") {

    element = Dom.getAncestorByTagName(this, "div");

    } else {element = this;

    }

    if (element !== null && name[element.id] !== undefined) {

    var elementname = document.getElementById("dragElementName");document.getElementById("txtx").value = Dom.getX(this);document.getElementById("txty").value = Dom.getY(this);

    if (element.id == "cwg_ConversationWin" || element.id ==

    "cwg_MessageWin" || element.id == "send_wrap" || element.id =="visiturl_wrap" || element.id == "close_wrap" || element.id =="minimize_wrap" || element.id == "typingstatus_wrap") {

    document.getElementById("txtWidth").value =Dom.getRegion(this).width;

    document.getElementById("txtHeight").value =Dom.getRegion(this).height;

    } else {document.getElementById("txtWidth").value = null;document.getElementById("txtHeight").value = null;

    }elementname.innerHTML = name[element.id];currentSelectedElement = element;

    }

    }function elementCurrentRegion(name) {

    if (name !== undefined && name !== "Window") {document.getElementById("txtWidth").value =

    parseInt(Dom.getRegion(currentSelectedElement).width);document.getElementById("txtHeight").value =

    parseInt(Dom.getRegion(currentSelectedElement).height);}

    }function elementCurrentPosition(name) {

    if (name !== undefined && name !== "Window") {

    var element = document.getElementById("dragElementName");document.getElementById("txtx").value =

    Dom.getX(currentSelectedElement);document.getElementById("txty").value =

    Dom.getY(currentSelectedElement);element.innerHTML = name;

    }}/*function setselecteditem() {

  • 8/3/2019 Var Windows

    36/91

    currentSelectedElement = this;elementCurrentPosition("Window");elementCurrentRegion("Window");

    }

    YAHOO.util.Event.addListener("cwg_chatDiv", "click", setselecteditem);*/function applyPosition() {

    debugger;if (typeof (currentSelectedElement) !== "undefined") {

    if (document.getElementById("dragElementName").innerHTML !== "ElementPositioning") {

    Dom.setX(currentSelectedElement,document.getElementById("txtx").value);

    Dom.setY(currentSelectedElement,document.getElementById("txty").value);

    if (currentSelectedElement.id == "cwg_ConversationWin" ||currentSelectedElement.id == "cwg_MessageWin" || currentSelectedElement.id =="send_wrap" || currentSelectedElement.id == "visiturl_wrap" ||currentSelectedElement.id == "close_wrap" || currentSelectedElement.id =="minimize_wrap" || currentSelectedElement.id == "typingstatus_wrap") {

    var el = Dom.getFirstChild(currentSelectedElement);var width = document.getElementById("txtWidth").value;var height = document.getElementById("txtHeight").value;Dom.setStyle(el, "width", width + 'px');Dom.setStyle(el, "height", height + 'px');Dom.setStyle(currentSelectedElement, "width", width + 'px');Dom.setStyle(currentSelectedElement, "height", height +

    'px');

    }} else {

    document.getElementById("dragElementName").innerHTML = "";

    msgalert("Please Select some elementFirst!");

    }} else {

    document.getElementById("dragElementName").innerHTML = "";msgalert("No Element is Selected, Please

    Select an Element to resize!");

    }}

    Event.delegate("cwg_chatDiv", "click", selectElement, "div");Event.delegate("positioning", "click", setposition, "td");//debugger;Event.delegate("containerbg", "mouseover", big, "img");Event.delegate("containerbg", "mouseout", small, "img");Event.delegate("containerbg", "click", setBackground, "img");

  • 8/3/2019 Var Windows

    37/91

    Event.delegate("mainAccordion", "mouseover", alertmessage, "span");// Alert Message

    function msgalert(msg) {$get("AlertMsg").innerHTML = msg;Dom.setStyle("alertDiv", "display", "block");var attributes = { opacity: { to: .7} };var conanim = new YAHOO.util.Anim("alertDiv", attributes, .5);conanim.animate();// setTimeout(distroymsg, 20000);

    }

    function distroymsg() {var attributes = { opacity: { to: 0} };var conanim = new YAHOO.util.Anim("alertDiv", attributes, .5);conanim.animate();conanim.onComplete.subscribe(function() {

    Dom.setStyle("alertDiv", "display", "none");});

    }

    function alertmessage() {var msg = new Array();msg['send_button'] = "HELP TIP: Send Button
    It is used to

    send chat. Please Click on a button to place it on the Selected Window'sBackground then you can position & resize it the way you want. Please Pressshift while resizing for Auto Ratio Resize. you can alo monitor its runtimesettings in the Element positioning area in the left bottom of the window.";

    msg['visit-url-button'] = "HELP TIP: Open Link Button
    It isused to open a url link sent by the chat operator. Please Click on a buttonto place it on the Selected Window's Background then you can position &resize it the way you want.Please Press shift while resizing for Auto RatioResize. you can alo monitor its runtime settings in the Element positioningarea in the left bottom of the window.";

    msg['close-button'] = "HELP TIP: Close Button
    The closebutton also follows the same pattern as the other buttons. When this buttonis clicked, the chat window is closed and the chat connection between thevisitor and an operator is broken.'";

    msg['minimize-button'] = "HELP TIP: Minimize Button
    These arethe two states of the minimize button. When the cursor is placed over thebutton, it changes color to indicate so. This button is clicked to minimizethe window.";

    msg['typing-status'] = "HELP TIP: Typing Status
    Thisindicator shows the visitor whether the operator is typing a message in thewindow or not.";

    msg['minimize-status'] = "HELP TIP: Minimized Status
    This isthe minimized state of the chat window. When the minimize button is clicked,the window minimizes to the image shown below. This image contains themaximization button as well. When a visitor wished to retrieve the window,they may do so by clicking this button.This is the minimized state of thechat window. When the minimize button is clicked, the window minimizes to theimage shown below. This image contains the maximization button as well. When

  • 8/3/2019 Var Windows

    38/91

    a visitor wished to retrieve the window, they may do so by clicking thisbutton.";

    msg['maximize-button'] = "HELP TIP: Maximize Button
    The sameis the case with the Maximize button, which also changes color when a cursoris placed over it. This button retrieves the chat window and sets it to itsorinigal size.";

    msg['online-button'] = "HELP TIP: Its an Indication that the operatoris available for the live support service, the images shows online if theoperator is available else it shows the offline.";

    msg['offline-button'] = "HELP TIP: Its an Indication that the operatoris available for the live support service, the images shows online if theoperator is available else it shows the offline.";

    msg['view-comp-conv'] = "HELP TIP: View Complete ConversationLink
    At any point in time when the user wants to view the completeconversation even after a while when he has switched many pages, he can seethe complete conversation!";

    msg['live-host'] = "HELP TIP: Live Host
    It shows theoperator name who's typing from the other end.";

    msg['Powered-By-Label'] = "HELP TIP: Powered By Label
    Thisis just a label to show the window creator. ";

    msg['on-minimize'] = "HELP TIP: Miniming
    Event on Minimizingchat window.";

    msg['wipe-out-minimize'] = "wipe-out-minimize";msg['fade-out-minimize'] = "HELP TIP: Fade Out
    Fade Out

    While Minimizing. ";msg['on-close'] = "HELP TIP: Closing
    Event on closing chat

    window";msg['wipe-out-close'] = "wipe-out-close";msg['fade-out-close'] = "HELP TIP: Fade Out
    Fade Out While

    Closing. ";

    if (msg[this.title] !== undefined) {msgalert(msg[this.title]);

    }

    if (Server_Response !== null && Server_Response !== undefined) {var skins_response, windows_skins, windows_response, send_response,

    visiturl_response, close_response, minimize_response, typingstatus_response,minimizestatus_response, maximize_response;

    var windows_skins_all = new Array();skins_response = Server_Response.split(":");windows_response = skins_response[0].split("/");windows_skins = windows_response[1].split("*");windows_skins_all = windows_skins[0];windowTitle = windows_skins[1];send_response = skins_response[1].split("/");visiturl_response = skins_response[2].split("/");

    close_response = skins_response[3].split("/");minimize_response = skins_response[4].split("/");typingstatus_response = skins_response[5].split("/");minimizestatus_response = skins_response[6].split("/");maximize_response = skins_response[7].split("/");online_response = skins_response[8].split("/");offline_response = skins_response[9].split("/");

    // Get Windows//

  • 8/3/2019 Var Windows

    39/91

    var windows = function() {

    windows_count++;

    if (windows_response[0] > 0) {var Window_configuration = { animation: { speed: 0.5 },

    numVisible: 9, revealAmount: 25 };make_carousel(windows_response, "skin/Background/",

    "containerbg", Window_configuration, "skins", '80px');}

    }

    //temp.prototype.win = windows;// Get Send Button//var send_button = function() {

    send_btn_count++;

    if (send_response[0] > 0) {var SendButton_configuration = { animation: { speed: 0.5 },

    numVisible: [2, 5] };make_carousel(send_response, "skin/SendButton/",

    "SendButtons", SendButton_configuration, "send", '58px');}

    }// Get Visit Url Button//var visiturl_button = function() {

    visiturl_btn_count++;if (visiturl_response[0] > 0) {

    var visitUrl_configuration = { animation: { speed: 0.5 },numVisible: [2, 5] };

    make_carousel(visiturl_response, "skin/UrlButton/","visitUrlContainer", visitUrl_configuration, "visiturl", '58px');

    }}// Get close Button//var close_button = function() {

    close_btn_count++;if (close_response[0] > 0) {

    var close_configuration = { animation: { speed: 0.5 },numVisible: [9, 5] };

    make_carousel(close_response, "skin/CloseButton/","closeContainer", close_configuration, "close", '14px');

    }}// Get minimize Button//var minimize_button = function() {

    minimize_btn_count++;if (minimize_response[0] > 0) {

    var minimize_configuration = { animation: { speed: 0.5 },numVisible: [9, 5] };

    make_carousel(minimize_response, "skin/MinimizeButton/","minimizeContainer", minimize_configuration, "minimize", '14px');

    }}// Get Typing Status//var typing_status = function() {

  • 8/3/2019 Var Windows

    40/91

    typing_status_count++;if (typingstatus_response[0] > 0) {

    var typingstatus_configuration = { animation: { speed: 0.5 },numVisible: [1, 5] };

    make_carousel(typingstatus_response, "skin/TypingStatus/","typingstatusContainer", typingstatus_configuration, "typingstatus", '70px');

    }}

    var minimize_status = function() {minimize_status_count++;if (minimizestatus_response[0] > 0) {

    var minimizedstatus_configuration = { animation: { speed: 0.5}, numVisible: [1, 5] };

    make_carousel(minimizestatus_response,"skin/MinimizedStatus/", "minimizedContainer", minimizedstatus_configuration,"ministatusdiv", '160px');

    }

    }var maximize_resp = function() {

    maximize_btn_count++;if (maximize_response[0] > 0) {

    var maximizestatus_configuration = { animation: { speed: 0.5}, numVisible: [9, 5] };

    make_carousel(maximize_response, "skin/MaximizeButton/","maximizeContainer", maximizestatus_configuration, "maxbutton", '14px');

    }}var online_resp = function() {

    online_btn_count++;if (online_response[0] > 0) {

    var online_configuration = { animation: { speed: 0.5 },numVisible: [2, 3] };

    make_carousel(online_response, "skin/OnlineButton/","onlineContainer", online_configuration, "onlinebutton", '80px');

    }}var offline_resp = function() {

    offline_btn_count++;if (offline_response[0] > 0) {

    var offline_configuration = { animation: { speed: 0.5 },numVisible: [2, 3] };

    make_carousel(offline_response, "skin/OfflineButton/",

    "offlineContainer", offline_configuration, "offlinebutton", '80px');

    }}if (this.title === "send_button") {

    if (send_btn_count < 1)send_button();

    }elseif (this.title === "visit-url-button") {

    if (visiturl_btn_count < 1)

  • 8/3/2019 Var Windows

    41/91

    visiturl_button();} elseif (this.title === "close-button") {

    if (close_btn_count < 1)close_button();

    } elseif (this.title === "minimize-button") {if (minimize_btn_count < 1)

    minimize_button();} elseif (this.title === "typing-status") {

    if (typing_status_count < 1)typing_status();

    } elseif (this.title === "minimize-status") {if (minimize_status_count < 1)

    minimize_status();} elseif (this.title === "maximize-button") {

    if (maximize_btn_count < 1)maximize_resp();

    } elseif (this.title === "online-button") {if (online_btn_count < 1)

    online_resp();} elseif (this.title === "offline-button") {

    if (offline_btn_count < 1)offline_resp();

    } elseif (this.title === "chat-windows") {if (windows_count < 1)

    windows();}

    }

    }function Help() {

    var panel = new YAHOO.widget.Panel("help", {draggable: true,width: "500px",height: "550px",autofillheight: "body", // default value, specified here to highlight

    its use in the exampleconstraintoviewport: true,

    context: ["help"]});panel.render();

    dd = new YAHOO.util.DD('help');$get("help").style.display = "block";$get("help").style.zIndex = 10000;

    }

    function UploadImage() {

    upload_panel_control.show();Event.on("cancel-upload", "click", upload_panel_control.hide, null,

    upload_panel_control);

  • 8/3/2019 Var Windows

    42/91

    Dom.setStyle("uploadwindow", "display", "block");

    //document.getElementById("upload_button").disabled = true;}

    // Arrow Key Positioning System //

    function onRightKeyPressFunc() {

    if (document.getElementById("dragElementName").innerHTML !== "ElementPositioning") {

    var xval = parseInt(document.getElementById("txtx").value);

    Dom.setX(currentSelectedElement, xval + 1);document.getElementById("txtx").value = xval + 1;

    } else {document.getElementById("dragElementName").innerHTML = "";msgalert("Please Select some element

    First!")}

    }var rightpress = new YAHOO.util.KeyListener(document, { keys: 39 },

    {fn: onRightKeyPressFunc, correctScope: true }, "keydown");rightpress.enable();

    function onLeftKeyPressFunc() {

    if (document.getElementById("dragElementName").innerHTML !== "ElementPositioning") {

    var xval = parseInt(document.getElementById("txtx").value);

    Dom.setX(currentSelectedElement, xval - 1);document.getElementById("txtx").value = xval - 1;

    } else {document.getElementById("dragElementName").innerHTML = "";msgalert("Please Select some element

    First!")}

    }var leftpress = new YAHOO.util.KeyListener(document, { keys: 37 },

    {fn: onLeftKeyPressFunc, correctScope: true }, "keydown");leftpress.enable();

    function onTopKeyPressFunc() {

    if (document.getElementById("dragElementName").innerHTML !== "ElementPositioning") {

    var yval = parseInt(document.getElementById("txty").value);

    Dom.setY(currentSelectedElement, yval - 1);document.getElementById("txty").value = yval - 1;

  • 8/3/2019 Var Windows

    43/91

    } else {document.getElementById("dragElementName").innerHTML = "";msgalert("Please Select some element

    First!")}

    }var toppress = new YAHOO.util.KeyListener(document, { keys: 38 },

    {fn: onTopKeyPressFunc, correctScope: true }, "keydown");toppress.enable();

    function onBottomKeyPressFunc() {

    if (document.getElementById("dragElementName").innerHTML !== "ElementPositioning") {

    var yval = parseInt(document.getElementById("txty").value);

    Dom.setY(currentSelectedElement, yval + 1);document.getElementById("txty").value = yval + 1;

    } else {document.getElementById("dragElementName").innerHTML = "";msgalert("Please Select some element

    First!")}

    }var bottompress = new YAHOO.util.KeyListener(document, { keys: 40 },

    {fn: onBottomKeyPressFunc, correctScope: true }, "keydown");bottompress.enable();

    //End Arrow Key Positioning System //

    function uploading(parent) {Dom.setStyle("upload_input", "display", "block");document.getElementById('loadingFrame').style.display = 'block';document.getElementById('WG_IFrame').style.visibility = 'hidden';upload_input_dd = new YAHOO.util.DD('upload_input');upload_input_dd.addInvalidHandleId('upload_url');

    if (Dom.get(parent).id !== 'cwg_chatDiv') {whotoupload = Dom.getFirstChild(parent);

    } else {

    whotoupload = Dom.get(parent);}

    Dom.setX("upload_input", Dom.getX(whotoupload));var imageHeight = parseInt(Dom.getStyle(whotoupload, "height"));Dom.setY("upload_input", Dom.getY(whotoupload) + imageHeight + 5);

    document.getElementById("previewImag").src = whotoupload.src;document.getElementById("uploadbutton-name").innerHTML =

    name[whotoupload.id];

  • 8/3/2019 Var Windows

    44/91

    if (Dom.get(parent).id !== 'cwg_chatDiv') {document.getElementById("upload_url").value = whotoupload.src;

    } else {document.getElementById("upload_url").value =

    Dom.getStyle(whotoupload, 'backgroundImage');

    }$get("UploadingPanel").style.display = "none";

    document.getElementById('WG_IFrame').src = 'ImageUploading.aspx?Element='+ name[whotoupload.id] + '&id=' + whotoupload.id;

    }function hideProgress() {

    document.getElementById('loadingFrame').style.display = 'none';document.getElementById('WG_IFrame').style.visibility = 'visible';

    }var imagesforAnimation, totalBanners;

    var animationIntervalSelect, animInterval, bannercount = 0;animationDD = new YAHOO.util.DD('addanimation');animationDD.addInvalidHandleClass('animationText');animationDD.addInvalidHandleId('animationInterval');animationDD.addInvalidHandleId('noofimages');animationDD.addInvalidHandleClass('upload');

    function previewAnimation() {//debugger;bannercount = 0;animationIntervalSelect = document.getElementById("animationInterval");animInterval =

    animationIntervalSelect.options[animationIntervalSelect.selectedIndex];imagesforAnimation = Dom.getElementsByClassName("animationText"),

    allImages = true;

    for (var i = 0; i < imagesforAnimation.length; i++) {if (imagesforAnimation[i].value == "Paste your link here or click

    upload" || imagesforAnimation[i].value == "") {allImages = false;

    }}if (allImages) {

    //debugger;Dom.setStyle("animationPreview", "display", "block");totalBanners = imagesforAnimation.length - 1;banners();

    } else {msgalert("Please add all images");

    }}

    var preview;ie5 = (document.all && document.getElementById);ns6 = (!document.all && document.getElementById);opac = 40;

  • 8/3/2019 Var Windows

    45/91

    function fade() {debugger;

    // if (opac = totalBanners)baner.style.backgroundImage = "url(" +

    imagesforAnimation[bannercount].value + ")";fade();if (bannercount >= totalBanners) { bannercount = 0; } else {

  • 8/3/2019 Var Windows

    46/91

    bannercount += 1;}animInterval =

    $get("animationInterval").options[$get("animationInterval").selectedIndex].value;

    preview = setTimeout(banners, animInterval.value * 1000);}

    function closeAnimationPreview() {clearTimeout(preview);Dom.setStyle("animationPreview", "display", "none");

    }

    function setAnimation() {debugger;// bannercount = 0;// var preview;// ie5 = (document.all && document.getElementById);// ns6 = (!document.all && document.getElementById);// opac = 40;

    function fade() {debugger;

    // if (opac

  • 8/3/2019 Var Windows

    47/91

    function banners() {

    debugger;var baner = document.getElementById("ad");var animInterval =

    $get("animationInterval").options[$get("animationInterval").selectedIndex].value;

    var imagesforAnimation = Dom.getElementsByClassName("animationText");// bannercount = -1;

    if (!bannercount >= totalBanners)baner.style.backgroundImage = "url(" +

    imagesforAnimation[bannercount].value + ")";fade();

    // if (bannercount >= totalBanners) { bannercount = 0; } else {// bannercount += 1;// }// animInterval =$get("animationInterval").options[$get("animationInterval").selectedIndex].value;// setTimeout(banners, animInterval.value * 1000);

    }

    // animInterval =$get("animationInterval").options[$get("animationInterval").selectedIndex].value;// preview = setTimeout(banners, animInterval.value * 1000);

    ////// for(var i=0;i

  • 8/3/2019 Var Windows

    48/91

    styleMainDiv += 'top: 0px;';styleMainDiv += 'left: 0px;';styleMainDiv += 'width: ' + screen.width + 'px;';styleMainDiv += 'height: ' + screen.height + 'px;';styleMainDiv += 'background-color: Gray;';styleMainDiv += 'filter: alpha(opacity=55);';styleMainDiv += 'opacity: 1.0;';

    }

    return styleMainDiv;}

    // Global Variables //var windows_count = 0, send_btn_count = 0, visiturl_btn_count = 0,close_btn_count = 0, minimize_btn_count = 0, typing_status_count = 0,minimize_status_count = 0, maximize_btn_count =0,online_btn_count=0,offline_btn_count=0;

    var layout, whotostyle,currentSelectedElement,whotoupload,closeUploadingPanel;

    // Help Alert Messages //var poisitioningAlertMessage = "This area is usedto show Positioning and resizing info of the Selected Element and also to setthe position and region of the element. You can see the info as well as setit at any point in time, just set the values in the text boxes and then clickthe button apply settings.";var poisitioningWindowAlertMessage = "This areais used to Set the Position the of the generated window that will apear onthe customer's website, you can set it by selecting position from the grid.by default its on the bottom-right corner of your website.
    You can also

    go specific on the positioning by entering the X and Y coordinates in thetextbox for X-axis and Y-axis.

    Note: Please enter valuesbetween 300 and -300. ";var enterwebsiteurl = "Please Enter the URL ofyour website in the textbox to see the window on the specified website whenpreviewing.";var elementsettings = "Check the checkboxes belowto have border on the generated window's text boxes. by default there's noborder."

  • 8/3/2019 Var Windows

    49/91

    var enterimageurl = "Please Enter the absoluteURL of the image in the textbox and press apply button to use your imageinstead of the default buttons in the chat window generator.";var adanimation="Dummy.";// End help Alerts//

    // Name vs Ids //var name = new Array();name["minimize_wrap"] = "Minimize Button";name["close_wrap"] = "Close Button";name["cwg_ConversationWin"] = "Conversation TextBox";name["cwg_MessageWin"] = "Message TextBox";name["send_wrap"] = "Send Button";name["visiturl_wrap"] = "Open Link Button";name["typingstatus_wrap"] = "Typing Status";name["minimize"] = "Minimize Button";name["close"] = "Close Button";name["send"] = "Send Button";name["visiturl"] = "Open Link Button";name["typingstatus"] = "Typing Status";

    name["livehostwraper"] = "Live Host Name";name["convwraper"] = "View Complete Conversation";name["labelwraper"] = "Powered By Label";name["addStyleHostName"]="Host Name";name["addStyleHostConversation"]="Host Conversation";name["addStyleVisitorName"]="Visitor Name";name["addStyleVisitorConversation"]="Visitor Conversation";name["logo"]="Your Company's Logo";name["cwg_languages_box"]="Language Box";name["cwg_chatDiv"]="Skin";

    // Yahoo User Interface Library //var Dom = YAHOO.util.Dom,

    Event = YAHOO.util.Event;var resize = new Array();

    var fadeInID;var Server_Response;var upload_panel_control;

    // Start the following function when Dom is ready //Event.onDOMReady(function() {

    // Setting the Layout of Chat Window Generator //layout = new YAHOO.widget.Layout({

    units: [{ position: 'top', height: 60, body: 'top1' },

    { position: 'right', width: 130, resize: false, collapse: false,scroll: false, body: 'right1', animate: true, gutter: '0' },

    { position: 'bottom', height: 165, body: 'bottom1', collapse:false, gutter: '0' },

    { position: 'left', width: 220, collapse: true, scroll: false,animate: true, body: 'left1', gutter: '0' },

    { position: 'center', body: 'center1', gutter: '0' }]

    });

  • 8/3/2019 Var Windows

    50/91

    layout.render();

    // Settings at CWG initialization //Dom.setStyle("LIVELOGO", "opacity", ".6");layout.getUnitByPosition('bottom').collapse();Event.delegate(document.body, "click", deSelectElement,"div");

    var cwg_ConversationWin = document.createElement("div");cwg_ConversationWin.id = "cwg_ConversationWin";

    document.getElementById('cwg_chatDiv').appendChild(cwg_ConversationWin);

    createStyleDiv("addStyleConversationwin",cwg_ConversationWin,"Style");createTextDiv("addStyleHostName",cwg_ConversationWin,"Host : ");createTextDiv("addStyleHostConversation",cwg_ConversationWin,"Host

    Conversation Text Comes here.. ");

    var cwg_MessageWin = document.createElement("div");cwg_MessageWin.id = "cwg_MessageWin";

    document.getElementById('cwg_chatDiv').appendChild(cwg_MessageWin);createStyleDiv("addStyleMessagewin",cwg_MessageWin,"Style");createTextDiv("addStyleVisitorName",cwg_MessageWin,"Visitor : ");createTextDiv("addStyleVisitorConversation",cwg_MessageWin,"Visitor

    Conversation Text Comes here.. ");

    // Making the window draggable and resizable //var backgroundresize = new YAHOO.util.Resize('cwg_chatDiv', {

    handles: ['r', 'b', 'br'],knobHandles: true,proxy: true,status: true,draggable: true,autoRatio:true,maxWidth: 500,maxHeight: 500,minWidth: 300,minHeight: 300

    });

    // Making the Message window draggable and resizable //var msgWin = new YAHOO.util.Resize("cwg_MessageWin", {

    handles: 'all',

    proxy: true,ghost: true,hover: true,draggable: true,autoRatio:true,status: true,minWidth: 20,maxWidth: 500,minHeight: 20,maxHeight: 400

  • 8/3/2019 Var Windows

    51/91

    });// Setting the OnDrag event for Message Window//msgWin.on('dragEvent', function() {

    currentSelectedElement = this;elementCurrentPosition("Message TextBox");

    });// Setting the OnResize event for Message Window//msgWin.on('resize', function() {

    currentSelectedElement = this;elementCurrentRegion("Message TextBox");

    });// Making the Conversation window draggable and resizable //var convWin = new YAHOO.util.Resize("cwg_ConversationWin", {

    handles: 'all',proxy: true,ghost: true,hover: true,

    draggable: true,autoRatio:true,status: true,minWidth: 20,maxWidth: 500,minHeight: 20,maxHeight: 400

    });// Setting the OnDrag event for conversation window //convWin.on('dragEvent', function() {

    currentSelectedElement = this;elementCurrentPosition("Conversation TextBox");

    });// Setting the OnResize event for conversation window//convWin.on('resize', function() {

    currentSelectedElement = this;elementCurrentRegion("Conversation TextBox");

    });

    // Failure handeling while error in getting the chat windows skin fromserver //

    var handleFailure = function(o) {msgalert("Problem with your internet

    connection" + o.responseText);

    }

    // Success function in getting the chat windows skin from server //var handleSuccess = function(o) {

    if (o.responseText !== undefined) {Server_Response = o.responseText;// getting the chat windows

    skins}

    }// Call back function after ajax call to get skins //

    var callback = {

  • 8/3/2019 Var Windows

    52/91

    success: handleSuccess,//call sucess handlerfailure: handleFailure

    };

    var request = YAHOO.util.Connect.asyncRequest('POST', "getSkins.aspx",callback); // ajax call to get the chat window skins //

    });

    function bringwindows() { // get the bottom of CWG interface visible, thatcontains chat windows //

    layout.getUnitByPosition("bottom").toggle();}

    function make_carousel(windows_response, path, carousel, config, HandleName,ratio) { // Make carousel for chat window elements //

    // Add Carousel //

    var olist = document.createElement("ol"); // create unordered listolist.setAttribute("class", "yui-carousel-element"); //set the classolist.id = "carousel"; // set the id

    // Create image dyanamically set the path and append it to the dom ina carousel

    for (var i = 1; i

  • 8/3/2019 Var Windows

    53/91

    image.setAttribute("onClick", "placeMaximizeButton(this.src)");// Handle the condition when the element is maximize button

    } else {if (carousel !== "containerbg") { // Handle the condition when the

    element is Containerimage.setAttribute("onClick", "placeButton(this.src,'" +

    HandleName + "')");}

    }var list = document.createElement("li");list.appendChild(image);list.setAttribute("class", "item loading");olist.appendChild(list);

    }Dom.get(carousel).appendChild(olist);YAHOO.widget.Carousel.prototype.CONFIG.MAX_PAGER_BUTTONS = 8; //

    configuration for carouselYAHOO.widget.Carousel.prototype.CONFIG.PAGER_PREFIX_TEXT="Page";HandleName = new YAHOO.widget.Carousel(carousel, config);

    HandleName.render(); // get ready for rendering the widgetHandleName.show(); // display the widget

    $('.'+carousel).jScale({ls:ratio}); // making the image size in nice scale

    }

    function displayColor() { // set color picker visible in CWG Interfacedocument.getElementById("colorpicker").style.display = 'block';

    }

    function Barva(color) { // Set the ColorDom.setStyle("chosencolor", 'background-