

strFormFieldIDPrefix = "idSVForm";
strTickElementID = "idSVTick";


/* POPUPS */

function fncSVPopupPage(strURL, strName, intWidth, intHeight) {
  if (strURL.length > 0) {
    var winPopup = window.open(strURL, strName, "width=" + intWidth + ",height=" + intHeight + ",menubar=no,location=no,resizable=yes,scrollbars=yes,status=no");
  }
}

function fncSVPopupTrigger(strPopupURL, strEmbedURL, strWindowTitle, intWidth, intHeight) {
  blnOpenPopup = true;
  if (document.getElementById('idSharedVue')) {
    var intAvailWidth = fncSVGetWidth(document.getElementById('idSharedVue'));
    var intAvailHeight = fncSVGetHeight(document.getElementById('idSharedVue'));
    if (intAvailWidth > (intWidth+30) && intAvailHeight > (intHeight+30)) {
      blnOpenPopup = false;
    }
  }
  if (blnOpenPopup) {
    fncSVPopupPage(strPopupURL, strWindowTitle, intWidth, intHeight);
  }
  else {
    document.location.href = strEmbedURL;
  }
}


/* LANGUAGE POPUP SELECTION */

tmrSVPopupNavLang = null;

function fncSVShowLangSelectPopup() {
  if (document.getElementById('idSVLangSelectPopup')) {
    if (document.getElementById('idSVLangSelectPopup').style.display == "block") {
      fncSVHideLangSelectPopup();
    }
    else {
      document.getElementById('idSVLangSelectPopup').style.display = "block";
    }
  }
}
function fncSVHideLangSelectPopup() {
  if (document.getElementById('idSVLangSelectPopup')) {
    document.getElementById('idSVLangSelectPopup').style.display = "none";
  }
}
function fncSVDelayHideLangSelectPopup() {
  tmrSVPopupNavLang = setTimeout("fncSVHideLangSelectPopup();",500);
}
function fncSVCancelHideLangSelectPopup() {
  clearTimeout(tmrSVPopupNavLang);
}


/* NAVIGATION POPUP */

tmrSVPopupNav = null;
astrSVPopupNavLabels = new Array(); // used to keep track of all popup nav labels
atmrSVPopupNav = new Array();

function fncSVShowNavPopup(strPopupLabel) {
  if (document.getElementById('idSVNavPopup' + strPopupLabel)) {
    if (document.getElementById('idSVNavPopupTrigger' + strPopupLabel)) {
      var intX = fncSVGetAbsoluteX(document.getElementById('idSVNavPopupTrigger' + strPopupLabel));
      var intY = fncSVGetAbsoluteY(document.getElementById('idSVNavPopupTrigger' + strPopupLabel));
      var intHeight = fncSVGetHeight(document.getElementById('idSVNavPopupTrigger' + strPopupLabel));
      document.getElementById('idSVNavPopup' + strPopupLabel).style.left = intX + "px";
      document.getElementById('idSVNavPopup' + strPopupLabel).style.top = (intY + intHeight) + "px";
    }
    document.getElementById('idSVNavPopup' + strPopupLabel).style.display = "block";
    if (typeof(fncSVAddClass) == "function") {
      fncSVAddClass(document.getElementById('idSVNavPopupTrigger' + strPopupLabel),"clsSVNavHover");
    }
  }
}

function fncSVHideNavPopup(strPopupLabel) {
  fncSVCancelHideNavPopup(strPopupLabel)
  if (document.getElementById('idSVNavPopup' + strPopupLabel)) {
    document.getElementById('idSVNavPopup' + strPopupLabel).style.display = "none";
    if (typeof(fncSVRemoveClass) == "function") {
      fncSVRemoveClass(document.getElementById('idSVNavPopupTrigger' + strPopupLabel),"clsSVNavHover");
    }
  }
}

function fncSVHideNavPopupAll() {
  for (var i=0;i<astrSVPopupNavLabels.length;i++) {
    fncSVHideNavPopup(astrSVPopupNavLabels[i])
  }
}

function fncSVDelayHideNavPopup(strPopupLabel) {
  atmrSVPopupNav[strPopupLabel] = setTimeout("fncSVHideNavPopup('" + strPopupLabel + "');",500);
}

function fncSVLongDelayHideNavPopup(strPopupLabel) {
  atmrSVPopupNav[strPopupLabel] = setTimeout("fncSVHideNavPopup('" + strPopupLabel + "');",1200);
}

function fncSVCancelHideNavPopup(strPopupLabel) {
  clearTimeout(atmrSVPopupNav[strPopupLabel]);
  atmrSVPopupNav[strPopupLabel] = null;
}



/* POPUP CONTENT BOXES */

function fncSVShowPopupContent(strID, oTrigger) {
  var strPopupContentContainerID = "idSVPopupContentContainer";
  var strPopupContentContainerMainID = strPopupContentContainerID + "Main";
  if (document.getElementById(strPopupContentContainerID) && document.getElementById(strPopupContentContainerMainID)) {
    var intYOffset = 12;
    var oSVPopupContainer = document.getElementById(strPopupContentContainerID);
    var oSVPopupContainerMain = document.getElementById(strPopupContentContainerMainID);
    oSVPopupContainer.style.display = "none";
    oSVPopupContainerMain.innerHTML = "";
    var intY = fncSVGetAbsoluteY(oTrigger);
    oSVPopupContainer.style.top = (intY + intYOffset) + "px";
    if (document.getElementById(strID)) {
      oSVPopupContainerMain.innerHTML = document.getElementById(strID).innerHTML;
      oSVPopupContainer.style.display = "block";
    }
  }
}


/* IFRAME SPECIFIC */

function fncSVCheckForResize() {
  if (typeof(fncIframeResize) == "function") { fncIframeResize(true); }
}


/* TRACKING AND CALLBACK */

function fncSVTickBack(strURL) {
  if (document.getElementById(strTickElementID) && strURL.length > 0) {
    document.getElementById(strTickElementID).src = strURL;
  }
}

function fncSVCallback(blnNew, blnReturn, strPID, strSID, strPRVID, strSType, strSURL, strSRef, strSRefK, strCVSID, heartBeat) {
    var strHitURL = strSharedVueServer + "/sharedvue/callback/" + fncSVDateTimeNow() + ".gif?new=" + blnNew + "&return=" + blnReturn + "&pid=" + strPID + "&sid=" + strSID;
    strHitURL += "&stype=" + strSType + "&surl=" + strSURL;
    if(strPRVID.length > 0) {strHitURL += "&prvid="+strPRVID;}
    if(strCVSID.length > 0) {strHitURL += "&cvsid="+strCVSID;}
    if (strSRef.length > 0) { strHitURL += "&sref=" + strSRef; }
    if (strSRefK.length > 0) { strHitURL += "&srefk=" + strSRefK; }
    fncSVTickBack(strHitURL);
    if (heartBeat) tmrPageRenderView = setTimeout(function() { fncSVCallback(blnNew, blnReturn, strPID, strSID, strPRVID, strSType, strSURL, strSRef, strSRefK, strCVSID, true) }, (intDelayBetweenViewTicks * 1000));
}

function fncSVHit(blnNew, blnReturn, strPID, strSID, strPRVID, strSType, strSURL, strSRef, strSRefK, strCVSID) {
  var strHitURL = strSharedVueServer +  "/sharedvue/hit/" + fncSVDateTimeNow() + ".gif?new="+blnNew+"&return="+blnReturn+"&pid="+strPID+"&sid="+strSID;
  strHitURL += "&stype="+strSType+"&surl="+strSURL;
  if(strPRVID.length > 0) {strHitURL += "&prvid="+strPRVID;}
  if(strCVSID.length > 0) {strHitURL += "&cvsid="+strCVSID;}
  if (strSRef.length > 0) { strHitURL += "&sref="+strSRef; }
  if (strSRefK.length > 0) { strHitURL += "&srefk="+strSRefK; }
  fncSVTickBack(strHitURL);
  tmrPageRenderView = setTimeout(function() { fncSVCallback(blnNew, blnReturn, strPID, strSID, strPRVID, strSType, strSURL, strSRef, strSRefK, strCVSID,true) }, (intDelayBetweenViewTicks * 1000));
}

function fncSVSetOnclick() {
  if (typeof(strSVSessionID) == "string" && typeof(document.getElementById("idSharedVue")) != "undefined") {
    var oContent = document.getElementById("idSharedVue");
    var oAnchors = oContent.getElementsByTagName("a");
    for (var i=0; i<oAnchors.length; i++) {
      if (oAnchors[i].getAttribute("href")) {
        strHREF = oAnchors[i].getAttribute("href");
        if (strHREF.length > 0) {
          if (strHREF.indexOf(strSVSessionID) < 0 && strHREF != "#" && strHREF.indexOf("mailto:") < 0) {
            strClassName = oAnchors[i].className;
            if (strClassName.indexOf("clsNoSID") < 0) {
              strAnchorHash = "";
              if (strHREF.indexOf("#") > 0) {
                strAnchorHash = strHREF.substr(strHREF.indexOf("#"),strHREF.length);
                strHREF = strHREF.replace(strAnchorHash,"");
              }
              if (strSVSIDServer.length > 0) { strHREF = strHREF.replace("sid="+strSVSIDServer,"sid="+strSVSessionID); }
              if (strHREF.indexOf("sid=" + strSVSessionID) < 1) {
                strHREF = strHREF + "&sid=" + strSVSessionID;
              }
              if (strAnchorHash.length > 0) {
                strHREF = strHREF+strAnchorHash;
              }
              strHREF = strHREF.replace(/\?/g,"&");
              strHREF = strHREF.replace(/&&/g,"&");
              strHREF = strHREF.replace(/\&/, "?");
              oAnchors[i].href = strHREF;
            }
          }
        }
      }
    }
  }
}

function fncSVPageTrackingInit() {
  if (typeof(fncSVVideoInit) == "function") { fncSVVideoInit('clsSVVideoEmbed'); } // initialize videos on page
	if (typeof intDelayBetweenViewTicks == "undefined") intDelayBetweenViewTicks = 60;
  var blnSVNewSession = true;
  var blnSVReturnVisitor = false;
  var strSVSID = '';
  strSVFirstVisit = fncSVGetCookie('sv-'+strSVPartnerID);
  if (strSVFirstVisit.length > 0) {
    blnSVReturnVisitor = true;
  }
  else {
    fncSVSetCookie('sv-'+strSVPartnerID, dtSVNow, 'never', '/');
  }
  if (typeof(strSVLeadContactID) == "string") {
    if (strSVLeadContactID.length > 0) {
      fncSVSetCookie('svlcid', strSVLeadContactID, 'never', '/');
    }
  }
  strSVLeadContactID = fncSVGetCookie('svlcid');
  if (blnSVReturnVisitor) {
    strSVSID = fncSVGetQSVar('sid');
    if (strSVSID.length > 0) {
      if (strSVSID == fncSVUniqueID(strSVPartnerID,strSVFirstVisit)) {
        blnSVNewSession = false;
      }
      else {
        strSVSID = "";
      }
    }
    else {
      strSVSID = fncSVUniqueID(strSVPartnerID,strSVFirstVisit);
    }
  }

  if (strSVSID.length <= 0) {
    strSVSID = fncSVUniqueID(strSVPartnerID,dtSVNow);
    strSVSIDServer = strSVSID
  }

  strSVSessionID = strSVSID;

  fncSVHit(blnSVNewSession, blnSVReturnVisitor, strSVPartnerID, strSVSID, strSVPageRenderViewID, strSVSyndicationType, strSVSyndicationURL, strSVSessionReferralSource, strSVSessionReferralKeywords, strSVCampaignViews);

  fncSVAppendOnload(fncSVSetOnclick); // Critical for retaining session info thru pages
  fncSVAppendOnUnload(function() { 
  	fncSVCallback(blnSVNewSession, blnSVReturnVisitor, strSVPartnerID, strSVSID, strSVPageRenderViewID, strSVSyndicationType, strSVSyndicationURL, strSVSessionReferralSource, strSVSessionReferralKeywords, strSVCampaignViews)
  });
}



/* FORMS */

function fncSVFormReferSubmit(oForm, strFormContainerID, strMethod, strAction) {
  var strError = "";
  var blnReturn = false;
  if (document.getElementById('idSVReferFromEmail')) { if (document.getElementById('idSVReferFromEmail').value.indexOf("@") < 1) { strError += "Please provide your Email address.\n"; } }
  if (document.getElementById('idSVReferToEmail')) { if (document.getElementById('idSVReferToEmail').value.indexOf("@") < 1) { strError += "Please provide your colleague's Email address.\n"; } }
  if (strError.length > 0) {
    alert(strError);
  }
  else {
    blnReturn = fncSVFormCheckSubmit(strFormContainerID, strMethod, strAction);
  }
  return blnReturn;
}

function fncSVFormCheckSubmit(strFormID, strMethod, strAction) {
  var strError = "";
  var intNumErrors = 0;
  var blnReturn = false;
  var strReqField, strReqFieldLabel;
  if (document.getElementById(strFormID)) {
    oFormContainer = document.getElementById(strFormID);

    if (document.getElementById(strFormFieldIDPrefix + 'ReqFields')) {
      strReqFields = document.getElementById(strFormFieldIDPrefix + 'ReqFields').value;
      if (strReqFields.length > 0) {
        strReqFields += ",";
        astrReqFields = strReqFields.split(",");
        for (strReqField in astrReqFields) {
          strReqField = astrReqFields[strReqField];
          strReqFieldLabel = "";
          strReqFieldValue = "";
          if (strReqField.length > 0 && typeof(strReqField) == "string") {
            if (strReqField.indexOf("[") > 0 && strReqField.indexOf("]") > 0) {
              strReqFieldLabel = fncSVTrim(strReqField.substr(strReqField.indexOf("[")+1,strReqField.length-strReqField.indexOf("[")-2));
              strReqFieldID = strFormFieldIDPrefix + fncSVTrim(strReqField.substr(0,strReqField.indexOf("[")));
            }
            if (document.getElementById(strReqFieldID)) {
              strReqFieldValue = fncSVFormFieldValue(strReqFieldID);
              if (strReqFieldLabel.indexOf("@") > 0) {
                if (strReqFieldValue.indexOf("@") <=1) {
                  strReqFieldLabel = strReqFieldLabel.replace("@","");
                  intNumErrors++;
                  if (strReqFieldLabel.length > 0) { strError += "     - " + strReqFieldLabel + " (valid email)\n"; }
                }
              }
              else if (strReqFieldValue.length < 1) {
                intNumErrors++;
                if (strReqFieldLabel.length > 0) { strError += "     - " + strReqFieldLabel + "\n"; }
              }
            }
          }
        }
      }
    }

    if (intNumErrors > 0) {
      strError = "Please provide a response for required fields.\n" + strError;
      alert(strError);
    }
    else {
  	  if (document.getElementById(strFormFieldIDPrefix+'SID')) {
  	    if (document.getElementById(strFormFieldIDPrefix+'SID').value.length < 1) {
  	      document.getElementById(strFormFieldIDPrefix+'SID').value = strSVSessionID;
  	    }
  	  }
  	  if (document.getElementById(strFormFieldIDPrefix+'LCID')) {
  	    if (document.getElementById(strFormFieldIDPrefix+'LCID').value.length < 1) {
  	      document.getElementById(strFormFieldIDPrefix+'LCID').value = strSVLeadContactID;
  	    }
  	  }

		  var strNewFormID = strFormID + "DYNFORM" + fncSVDateTimeNow();
  	  if (document.getElementById(strNewFormID)) {
  	  	document.getElementById(strNewFormID).id = strNewFormID + "OLD";
  	  }
  	  var oBody = document.body;
  	  var oTmpForm = document.createElement('FORM');
  	  oTmpForm.id = strNewFormID;
  	  oTmpForm.method = strMethod;
  	  oTmpForm.action = strAction;

  	  var oFormFields = oFormContainer.getElementsByTagName("INPUT");
  	  var strHTMLNewFields = "";
  	  for (var i=0;i<oFormFields.length;i++) {
  	    var blnCreateField = false;
  	    if (oFormFields[i].type == "radio") {
  	      if (oFormFields[i].checked) {
  	        blnCreateField = true;
  	      }
  	    }
  	    else if (oFormFields[i].type == "checkbox") {
  	      if (oFormFields[i].checked) {
  	        blnCreateField = true;
  	      }
  	    }
  	    else {
  	      blnCreateField = true;
  	    }
  	    if (blnCreateField) {
  	      strHTMLNewFields += "<input type=\"hidden\" name=\"" + oFormFields[i].name + "\" value=\"" + oFormFields[i].value + "\" />";
        }
  	  }
  	  oFormFields = oFormContainer.getElementsByTagName("TEXTAREA");
  	  for (var i=0;i<oFormFields.length;i++) {
  	  	strHTMLNewFields += "<input type=\"hidden\" name=\"" + oFormFields[i].name + "\" value=\"" + oFormFields[i].value + "\" />";
  	  }
  	  oFormFields = oFormContainer.getElementsByTagName("SELECT");
  	  for (var i=0;i<oFormFields.length;i++) {
  	  	strHTMLNewFields += "<input type=\"hidden\" name=\"" + oFormFields[i].name + "\" value=\"" + oFormFields[i].value + "\" />";
  	  }

  	  oTmpForm.innerHTML = strHTMLNewFields;
  	  oBody.insertAdjacentElement("beforeEnd",oTmpForm);
  	  oTmpForm.submit();
    }
	}
	return false;
}

function fncSVFormSetVal(strTargetID, strValue) {
  if (strValue.length > 0) {
    if (document.getElementById(strTargetID)) {
      document.getElementById(strTargetID).value = strValue;
    }
  }
}

function fncSVFormFieldValue(strFieldID) {
  var strValue = "";
  if (document.getElementById(strFieldID)) {
    oFormField = document.getElementById(strFieldID);
    if (typeof(oFormField.type) == "string") {
      if (oFormField.tagName.toLowerCase() == "select") {
        if (oFormField.options[oFormField.selectedIndex].value.length > 0) {
          strValue = oFormField.options[oFormField.selectedIndex].value;
        }
      }
      else {
        strValue = oFormField.value;
      }
    }
  }
  return strValue;
}

function fncSVSetFormWithCookieValues() {
  if (document.getElementById(strFormFieldIDPrefix + 'FirstName')) { document.getElementById(strFormFieldIDPrefix + 'FirstName').value = unescape(fncSVGetCookie('firstname')); }
  if (document.getElementById(strFormFieldIDPrefix + 'LastName')) { document.getElementById(strFormFieldIDPrefix + 'LastName').value = unescape(fncSVGetCookie('lastname')); }
  if (document.getElementById(strFormFieldIDPrefix + 'Email')) { document.getElementById(strFormFieldIDPrefix + 'Email').value = unescape(fncSVGetCookie('email')); }
  if (document.getElementById(strFormFieldIDPrefix + 'Phone')) { document.getElementById(strFormFieldIDPrefix + 'Phone').value = unescape(fncSVGetCookie('phone')); }
  if (document.getElementById(strFormFieldIDPrefix + 'Title')) { document.getElementById(strFormFieldIDPrefix + 'Title').value = unescape(fncSVGetCookie('title')); }
  if (document.getElementById(strFormFieldIDPrefix + 'Company')) { document.getElementById(strFormFieldIDPrefix + 'Company').value = unescape(fncSVGetCookie('company')); }
  if (document.getElementById(strFormFieldIDPrefix + 'Industry')) { document.getElementById(strFormFieldIDPrefix + 'Industry').value = unescape(fncSVGetCookie('industry')); }
  if (document.getElementById(strFormFieldIDPrefix + 'Address')) { document.getElementById(strFormFieldIDPrefix + 'Address').value = unescape(fncSVGetCookie('address')); }
  if (document.getElementById(strFormFieldIDPrefix + 'City')) { document.getElementById(strFormFieldIDPrefix + 'City').value = unescape(fncSVGetCookie('city')); }
  if (document.getElementById(strFormFieldIDPrefix + 'State')) { document.getElementById(strFormFieldIDPrefix + 'State').value = unescape(fncSVGetCookie('state')); }
  if (document.getElementById(strFormFieldIDPrefix + 'Zipcode')) { document.getElementById(strFormFieldIDPrefix + 'Zipcode').value = unescape(fncSVGetCookie('zipcode')); }
}


/* RESOURCE LIBRARY ITEMS */

function fncSVRLRegToggleAction() {
  if (typeof(blnSVDoRLProcessing) != "undefined") {
    if (blnSVDoRLProcessing) {
      fncSVRLHit();
      var strSVEmail = fncSVGetCookie('email');
      var strSVNameFirst = fncSVGetCookie('firstname');
      var strSVNameLast = fncSVGetCookie('lastname');
      strSVLeadContactID = fncSVGetCookie('svlcid');
      if (strSVRLFormID.length > 0 && strSVRLDownloadID.length > 0) {
        if (strSVFirstVisit.length > 0 && strSVEmail.length > 0 && strSVLeadContactID.length > 0) {
          // already know who they are.... show download
          document.getElementById(strSVRLDownloadID).style.display = "block";
        }
        else {
          // some missing info - show form
          document.getElementById(strSVRLFormID).style.display = "block";
        }
      }
    }
  }
}

function fncSVRLHit() {
  var strHitURL = strSharedVueServer + strSharedVuePath + "rl/hit.asp?rlid=" + strSVRLItemID + "&rlp=" + blnSVPartnerRLItem + "&date=" + fncSVDateTimeNow();
  var tmrTmp = setTimeout(function() { fncSVTickBack(strHitURL) },(500)); // give the page hit time to process
}

function fncSVRLView(oSrc, strIDToShow) {
  var blnReferal = strSVSessionReferralSource;
  if (document.getElementById(strTickElementID)) {
    var strSVEmail = fncSVGetCookie('email');
    var strSVNameFirst = fncSVGetCookie('firstname');
    var strSVNameLast = fncSVGetCookie('lastname');
    var strViewURL = strSharedVueServer + strSharedVuePath + "rl/view.asp?sid=" + strSVSessionID + "&rlid=" + strSVRLItemID + "&rlp=" + blnSVPartnerRLItem + "&pid=" + strSVPartnerID + "&ref=" + blnReferal + "&lcid=" + strSVLeadContactID + "&e=" + escape(strSVEmail) + "&nf=" + strSVNameFirst + "&nl=" + strSVNameLast + "&date=" + fncSVDateTimeNow();
    fncSVTickBack(strViewURL);
  }
  oSrc.style.display = "none";
  document.getElementById(strIDToShow).style.visibility = "visible";
  // window.open(strURL, '_rl'+strSVRLItemID); // issues with stream/loading for some users
}

function fncSVRLViewDownload(strFrameID) {
  var blnReferal = false
  if (strSVSessionReferralSource.length > 0) { blnReferal = true; }
  if (document.getElementById(strFrameID)) {
    var strSVEmail = fncSVGetCookie('email');
    var strSVNameFirst = fncSVGetCookie('firstname');
    var strSVNameLast = fncSVGetCookie('lastname');
    var strViewDownloadURL = strSharedVueServer + strSharedVuePath + "rl/dl.asp?sid=" + strSVSessionID + "&rlid=" + strSVRLItemID + "&rlp=" + blnSVPartnerRLItem + "&pid=" + strSVPartnerID + "&ref=" + blnReferal + "&lcid=" + strSVLeadContactID + "&e=" + escape(strSVEmail) + "&nf=" + strSVNameFirst + "&nl=" + strSVNameLast + "&date=" + fncSVDateTimeNow();
    document.getElementById(strFrameID).src = strViewDownloadURL;
    // window.open(strViewDownloadURL, '_rl'+strSVRLItemID); // issues with stream/loading for some users
  }
}


/* VIDEO EMBED - FLOWPLAYER */

function fncSVVideoSetup(strContainerID, strThumbnailURL, strFLVURL, intWidth, intHeight) {
  // document.getElementById(strContainerID).style.backgroundImage = "url(" + strThumbnailURL + ")";
  // document.getElementById(strContainerID).innerHTML = "<img src='http://ciscoin.sharedvue.net/common/synd/images/_dot.gif' alt='' border='' />";
  document.getElementById(strContainerID).style.width = intWidth + "px";
  document.getElementById(strContainerID).style.height = intHeight + "px";
  document.getElementById(strContainerID).href = strFLVURL;
  var intPlayTop = (intHeight/2) - 22;
  var intPlayLeft = (intWidth/2) - 22;
  var strIMGPlay = "<img src='http://ciscoin.sharedvue.net/common/synd/images/play.png' width='44' height='44' border='0' class='clsSVPNG' style='margin-top:" + intPlayTop + "px;margin-left:" + intPlayLeft + "px;' />";
  var strIMGThumbnail = "<img src='" + strThumbnailURL + "' width='" + intWidth + "' height='" + intHeight + "' alt='' border='0' />";
  document.getElementById(strContainerID).innerHTML = strIMGPlay + strIMGThumbnail;
}

function fncSVVideoInit(strPlayerContainerClass) {
  if (typeof(flowplayer) != "undefined") {
    var strVideoID = null;
    var intRand = Math.floor(Math.random()*99999);
    var strPlayerSWFURL = "http://ciscoin.sharedvue.net/common/synd/scripts/flowplayer.swf?rand="+intRand;
    var strPlayerControlsURL = "http://ciscoin.sharedvue.net/common/synd/scripts/flowplayer.controls.swf";
    flowplayer("a." + strPlayerContainerClass, {wmode: "transparent", src: strPlayerSWFURL}, { 
      clip: {
        // autoPlay: false, 
        // autoBuffering: false,
        onStart: function(clip){
        
          if (typeof(clip.fullDuration) == "number") {
            var strVideoID = this.id();
            if (typeof(strVideoID) == "string" && strVideoID.length > 0) {
              /*
              var strVideoPlayURL = "http://ciscoin.sharedvue.net/sharedvue/resources/content/videoplay.asp?v=" + strVideoID + "&datestamp=" + fncSVDateTimeNow();
              fncSVTickBack(strVideoPlayURL);
              */
            }
    	    }
  	    }
      },
      plugins: { 
        controls: { 
          url: strPlayerControlsURL, 
          bottom:0, 
          height:18, 
          zIndex:1, 
          backgroundColor: '#777777', 
          backgroundGradient: 'low', 
          fontColor: '#ffffff',
          timeFontColor: '#333333', 
          autoHide: 'always', 
          hideDelay: 2000,
          play: true, 
          volume: true, 
          mute: true, 
          time: false, 
          stop: false, 
          playlist: false, 
          fullscreen: false, 
          scrubber: true 
        } 
      }  
    });
  }
}


/* RATINGS */

function fncSVRatingPreview(strSourceImgID,intRating) {
  var oImg = document.getElementById(strSourceImgID);
  oImg.src = strSharedVueSkinURL + "star-gold_group_" + intRating + "0.gif";
  var strRating = "";
  switch(intRating) {
    case 1:
      strRating = "Poor";
      break
    case 2:
      strRating = "Fair";
      break
    case 3:
      strRating = "Good";
      break
    case 4:
      strRating = "Great";
      break
    case 5:
      strRating = "Excellent";
      break
  }
  document.getElementById('idRatingTxt').innerHTML = strRating;
}

function fncSVRatingPreviewDefault(strSourceImgID) {
  var oImg = document.getElementById(strSourceImgID);
  oImg.src = strSharedVueSkinURL + "star-gray_group_50.gif";
  document.getElementById('idRatingTxt').innerHTML = "&nbsp;";
}

function fncSVShowRating(oTrigger, strItemID, intTotalRating, intNumRatings) {
  strSVActiveRLRatingItem = strItemID;
  strSVActiveRLRatingTotalRating = intTotalRating;
  strSVActiveRLRatingNumRatings = intNumRatings;
}

function fncSVRatingSet(intRating, blnPartnerRLItem) {
  if (typeof(strSVActiveRLRatingItem) != "undefined") {
    var strImageID = "idRatingMapImg";

    if (document.getElementById('idRLItemRating_' + strSVActiveRLRatingItem)) {
      /*
      if (typeof(strSVActiveRLRatingTotalRating) != "undefined") {
        strSVActiveRLRatingTotalRating = 0
      }
      if (typeof(strSVActiveRLRatingNumRatings) != "undefined") {
        strSVActiveRLRatingNumRatings = 0
      }

      strSVActiveRLRatingTotalRating = ((strSVActiveRLRatingTotalRating * 1) + intRating*1)
      strSVActiveRLRatingNumRatings = ((strSVActiveRLRatingNumRatings * 1) + 1*1)
      if (strSVActiveRLRatingTotalRating > 0 && strSVActiveRLRatingNumRatings > 0) {
        intRating = strSVActiveRLRatingTotalRating / strSVActiveRLRatingNumRatings
        intRating = Math.round(intRating*100)/100
      }
      document.getElementById('idRLItemRating_' + strSVActiveRLRatingItem).innerHTML = intRating;
      */
      document.getElementById('idRatingRLStars').innerHTML = "<br /><em>Thank You</em>";
    }
    
    var strRatingURL = strSharedVueServer + strSharedVuePath + "rlitemrating.asp?id=" + strSVActiveRLRatingItem + "&rating=" + intRating + "&partnerrlitem=" + blnPartnerRLItem + "&date=" + fncSVDateTimeNow();
    fncSVTickBack(strRatingURL);
    //window.open(strRatingURL);
    //document.getElementById(strImageID).src = strRatingURL;
    
    strSVActiveRLRatingItem = "";
    strSVActiveRLRatingTotalRating = 0;
    strSVActiveRLRatingNumRatings = 0;
  }
}


/* EVENTS */

function fncSVAddEvent(objAttachTo, strEventType, objFunctionToAdd){ 
  if (objAttachTo.addEventListener){ 
    objAttachTo.addEventListener(strEventType, objFunctionToAdd, false); 
    return true; 
  } else if (objAttachTo.attachEvent){ 
    var r = objAttachTo.attachEvent("on"+strEventType, objFunctionToAdd); 
    return r; 
  } else { 
    return false; 
  } 
}


function fncSVAppendOnload(fncAddedFunction) {
  var fncExistingOnloadFunction = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = fncAddedFunction;
  } else {
    window.onload = function() {
      fncExistingOnloadFunction();
      fncAddedFunction();
    }
  }
}

function fncSVAppendOnUnload(newMethod) {
	if (typeof newMethod != 'function') return;
  var unloadMethod = window.onunload;
  if (typeof window.onunload != 'function') {
    window.onunload = newMethod;
  } else {
    window.onunload = function() {
      fncExistingOnloadFunction();
      fncAddedFunction();
    }
  }
}


/* DATE/TIME */

function fncSVDateTimeNow() {
  var strDateTime = "";
  var dtNow = new Date();
  var dtStart = new Date(2000,0,1);
  var intDiffMS = dtNow-dtStart;
  intDiffMS = Math.round(intDiffMS/1000);
  strDateTime = intDiffMS;
  return strDateTime;
}

function fncSVDaysToGMTDate(intDays) {
  var dtNewDate = new Date();
  var intMS;
  dtNewDate.setTime(dtNewDate.getTime()+((intDays)*24*60*60*1000));
  intMS = Date.parse(dtNewDate);
  return intMS;
}

function fncSVMinutesToGMTDate(intMinutes) {
  var dtNewDate = new Date();
  var intMS;
  dtNewDate.setTime(dtNewDate.getTime()+(24*60*60*1000));
  intMS = Date.parse(dtNewDate);
  return intMS;
}




function fncSVGetQSVar(strQSVar){
  var temp = self.document.location.search;
  var intLoc = -1;
  temp = temp.replace("?","&");
  intLoc = temp.indexOf("&"+strQSVar+"=")+1;
  if (intLoc > 0) {
    temp = temp.substring((intLoc+(strQSVar.length+1)), temp.length);
    temp = temp.substring(0, (((temp.indexOf('&') >=0 )?temp.indexOf('&'):temp.length)));
  }
  else {
    temp = "";
  }
  return unescape(temp);
}

function fncSVTrim(strSource) {
  var strReturn = strSource;
  if (typeof(strReturn) == "string") {
    if (strReturn.length > 0) {
      strReturn = strReturn.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,"");
    }
  }
  return strReturn;
}


/* COOKIES */

function fncSVSetCookie(name, value, exp, path, domain) {
  if(exp == "") { exp = "never"; }
  if(path == "") { path = "/"; }
  if (typeof(exp) == 'string') {
    if (exp == 'never') {
      var strExp = "Thu, 7 Dec 2113 01:00:00 UTC";
    }
    else if (exp == 'exp' || exp == 'now') {
      var strExp = "Fri, 13 Apr 1970 01:00:00 UTC";
    }
  }
  else {
    if (Date.parse(exp)) {
     var strExp = exp;
    }
    else {
      exp = exp*1;
      if (isNaN(exp)) {
       var strExp = (new Date((new Date()).getTime() + 840*3600000)).toGMTString();
      }
      else {
       var strExp = (new Date((new Date()).getTime() + exp*3600000)).toGMTString();
      }
    }
  }
  if (typeof(strExp) == "undefined") {
    var strExp = (new Date((new Date()).getTime() + 840*3600000)).toGMTString();
  }
  document.cookie = name + '=' + escape(value) + ((strExp)?(';expires=' + strExp):'') + ((path)?';path=' + path:'') + ( ( domain ) ? ";domain=" + domain : "" );
}


function fncSVGetCookie(strCookieName) {
  var strCookie = new String();
  strCookie = document.cookie;
  var exp = new RegExp("^.*" + strCookieName + "=" );
  if (strCookie.match(exp)){
    strCookie = strCookie.replace(exp,'');
    strCookie = strCookie.replace(/;.*/,'');
    return strCookie;
  }
  return "";
}

function fncSVDelCookie(strCookieName) {
  fncSVSetCookie(strCookieName, null, -1);
}

function fncSVForgetMe() {
  var blnForgetMe = confirm("Are you sure you wish to remove your cookies for this site?");
  if (blnForgetMe) {
    fncSVDelCookie("sv-" + strSVPartnerID);
    fncSVDelCookie("svlcid");
    fncSVDelCookie("email");
    fncSVDelCookie("firstname");
    fncSVDelCookie("lastname");
    fncSVDelCookie("phone");
    fncSVDelCookie("title");
    fncSVDelCookie("company");
    fncSVDelCookie("industry");
    fncSVDelCookie("address");
    fncSVDelCookie("city");
    fncSVDelCookie("state");
    fncSVDelCookie("zipcode");
  }
}


/* CSS CLASSES */

function fncSVHasClass(oSrc,strClassName) {
  var blnReturn = false;
  if (oSrc) {
    var strTmp = oSrc.className + " ";
    var astrClassNames = strTmp.split(" ");
    for (var i=0;i<astrClassNames.length;i++) {
      if (astrClassNames[i] == strClassName) {
        blnReturn = true;
        break;
      }
    }
  }
  return blnReturn;
}

function fncSVAddClass(oElement, strClassName) {
  if (typeof(oElement) == "object" && strClassName.length > 0) {
    if (typeof(oElement.className) == "string") {
      var strCurrentClassName = oElement.className;
      if (!fncSVHasClass(oElement,strClassName)) {
        if (strCurrentClassName.length > 1) {
          strClassName = strCurrentClassName + " " + strClassName;
        }
        oElement.className = strClassName;
      }
    }
  }
}

function fncSVRemoveClass(oElement, strClassName) {
  if (typeof(oElement) == "object" && strClassName.length > 0) {
    if (typeof(oElement.className) == "string") {
      var strCurrentClassName = oElement.className;
      if (fncSVHasClass(oElement,strClassName)) {
        strNewClassName = fncSVRemoveClassRecursive(" " + strCurrentClassName + " ", " " + strClassName + " ");
        if (strNewClassName.indexOf(" ") == 0) { strNewClassName = strNewClassName.substring(1); }
        if (strNewClassName.lastIndexOf(" ") == strNewClassName.length-1) { strNewClassName = strNewClassName.substring(0,strNewClassName.length-1); }
        oElement.className = strNewClassName;
      }
    }
  }
}

function fncSVRemoveClassRecursive(strSource, strSubstrToRemove) {
  var intIndex = strSource.indexOf(strSubstrToRemove);
  var strReturn = "";
  if (intIndex == -1) return strSource;
  strReturn += strSource.substring(0,intIndex) + " " + fncSVRemoveClassRecursive(strSource.substring(intIndex + strSubstrToRemove.length), strSubstrToRemove);
  return strReturn;
}


/* POSITIONING */

function fncSVGetWidth(oObjectToGetSize) {
  var intWidth = null;
  if (typeof(oObjectToGetSize) == "string") {
    if (document.getElementById(oObjectToGetSize)) {
      oObjectToGetSize = document.getElementById(oObjectToGetSize);
    }
  }
  if (typeof(oObjectToGetSize) == "object") {
    intWidth = oObjectToGetSize.offsetWidth;
  }
  return intWidth;
}

function fncSVGetHeight(oObjectToGetSize) {
  var intHeight = null;
  if (typeof(oObjectToGetSize) == "string") {
    if (document.getElementById(oObjectToGetSize)) {
      oObjectToGetSize = document.getElementById(oObjectToGetSize);
    }
  }
  if (typeof(oObjectToGetSize) == "object") {
    intHeight = oObjectToGetSize.offsetHeight;
  }
  return intHeight;
}

function fncSVGetAbsoluteX(oElement) {
  if (typeof(oElement) == "string") {
    oElement = document.getElementById(oElement);
  }
  if (typeof(oElement) == "object") {
    var intCoords = {x: 0};
    while (oElement) {
      intCoords.x += oElement.offsetLeft;
      oElement = oElement.offsetParent;
    }
    return intCoords.x;
  }
}

function fncSVGetAbsoluteY(oElement) {
  if (typeof(oElement) == "string") {
    oElement = document.getElementById(oElement);
  }
  if (typeof(oElement) == "object") {
    var intCoords = {y: 0};
    while (oElement) {
      intCoords.y += oElement.offsetTop;
      oElement = oElement.offsetParent;
    }
    return intCoords.y;
  }
}


function fncSVUniqueID(strPartnerID,strSVDateTime) {
  var strProperties = "";
  strProperties += navigator.appName + "\n";
  strProperties += navigator.appCodeName + "\n";
  strProperties += navigator.userAgent + "\n";
  strProperties += navigator.appVersion + "\n";
  strProperties += navigator.platform + "\n";
  strProperties += screen.width + "\n";
  strProperties += screen.height + "\n";
  strProperties += screen.colorDepth + "\n";
  strProperties += navigator.platform + "\n";
  strProperties += navigator.userAgent + "\n";
  if (navigator.appName == "Microsoft Internet Explorer") {
    if (!document.getElementById('oClientCaps')) {
      document.writeln('<IE:clientCaps ID="oClientCaps" style="{behavior:url(#default#clientcaps)}" />');
    }
    if (typeof(oClientCaps) == "object") {
      strIEProps = "";
      strIEProps = oClientCaps.cpuClass + "\n";
      strIEProps += oClientCaps.connectionType + "\n";
      strIEProps += oClientCaps.platform + "\n";
      strIEProps += oClientCaps.systemLanguage + "\n";
      strIEProps += oClientCaps.userLanguage + "\n";
      strIEProps += oClientCaps.javaEnabled + "\n";

      var strClientIDs = "{7790769C-0471-11D2-AF11-00C04FA35D02},{89820200-ECBD-11CF-8B85-00AA005B4340},{283807B5-2C60-11D0-A31D-00AA00B92C03},{4F216970-C90C-11D1-B5C7-0000F8051515},{44BBA848-CC51-11CF-AAFA-00AA00B6015C},{9381D8F2-0288-11D0-9501-00AA00B911A5},{4F216970-C90C-11D1-B5C7-0000F8051515},{5A8D6EE0-3E18-11D0-821E-444553540000},{89820200-ECBD-11CF-8B85-00AA005B4383},{08B0E5C0-4FCB-11CF-AAA5-00401C608555},{45EA75A0-A269-11D1-B5BF-0000F8051515},{DE5AED00-A4BF-11D1-9948-00C04F98BBC9},{22D6F312-B0F6-11D0-94AB-0080C74C7E95},{44BBA842-CC51-11CF-AAFA-00AA00B6015B},{3AF36230-A269-11D1-B5BF-0000F8051515},{44BBA840-CC51-11CF-AAFA-00AA00B6015C},{CC2A9BA0-3BDD-11D0-821E-444553540000},{08B0E5C0-4FCB-11CF-AAA5-00401C608500},{90A7533D-88FE-11D0-9DBE-0000C0411FC3},{1CDEE860-E95B-11CF-B1B0-00AA00BBAD66}";
      var astrClientIDs = strClientIDs.split(",");

      for(i=0;i<astrClientIDs.length;i++) {
        try {
          if(oClientCaps.isComponentInstalled(astrClientIDs[i],"ComponentID")){
            strIEProps += oClientCaps.getComponentVersion(astrClientIDs[i], "ComponentID") + "\n";
          }
        } catch (e) {
        }
      }

      if (strIEProps.length > 0) { strProperties += strIEProps; }
    }
  }
  else {
    var strMimeTypes = "";
    for (i=0; i < navigator.mimeTypes.length; i++) {
      if(navigator.mimeTypes[i].type != null) {
        strMimeTypes += navigator.mimeTypes[i].type + "\n";
        /*
        if (navigator.mimeTypes[i].enabledPlugin!=null) {
          strMimeTypes = strMimeTypes + " -- " + navigator.mimeTypes[i].enabledPlugin.name;
        }
        */
      }
    }
    if (strMimeTypes.length > 0) { strProperties += strMimeTypes; }
  }
  return fncSVhexMD5(strPartnerID + strSVDateTime + strProperties);
}


function fncSVhexMD5(s){ return fncSVbinl2hex(fncSVcoreMD5(fncSVstr2binl(s), s.length * 8));}


function fncSVcoreMD5(x, len) {
  /* append padding */
  x[len >> 5] |= 0x80 << ((len) % 32);
  x[(((len + 64) >>> 9) << 4) + 14] = len;

  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;

  for(var i = 0; i < x.length; i += 16)
  {
    var olda = a;
    var oldb = b;
    var oldc = c;
    var oldd = d;

    a = fncSVMD5ff(a, b, c, d, x[i+ 0], 7 , -680876936);
    d = fncSVMD5ff(d, a, b, c, x[i+ 1], 12, -389564586);
    c = fncSVMD5ff(c, d, a, b, x[i+ 2], 17,  606105819);
    b = fncSVMD5ff(b, c, d, a, x[i+ 3], 22, -1044525330);
    a = fncSVMD5ff(a, b, c, d, x[i+ 4], 7 , -176418897);
    d = fncSVMD5ff(d, a, b, c, x[i+ 5], 12,  1200080426);
    c = fncSVMD5ff(c, d, a, b, x[i+ 6], 17, -1473231341);
    b = fncSVMD5ff(b, c, d, a, x[i+ 7], 22, -45705983);
    a = fncSVMD5ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
    d = fncSVMD5ff(d, a, b, c, x[i+ 9], 12, -1958414417);
    c = fncSVMD5ff(c, d, a, b, x[i+10], 17, -42063);
    b = fncSVMD5ff(b, c, d, a, x[i+11], 22, -1990404162);
    a = fncSVMD5ff(a, b, c, d, x[i+12], 7 ,  1804603682);
    d = fncSVMD5ff(d, a, b, c, x[i+13], 12, -40341101);
    c = fncSVMD5ff(c, d, a, b, x[i+14], 17, -1502002290);
    b = fncSVMD5ff(b, c, d, a, x[i+15], 22,  1236535329);

    a = fncSVMD5gg(a, b, c, d, x[i+ 1], 5 , -165796510);
    d = fncSVMD5gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
    c = fncSVMD5gg(c, d, a, b, x[i+11], 14,  643717713);
    b = fncSVMD5gg(b, c, d, a, x[i+ 0], 20, -373897302);
    a = fncSVMD5gg(a, b, c, d, x[i+ 5], 5 , -701558691);
    d = fncSVMD5gg(d, a, b, c, x[i+10], 9 ,  38016083);
    c = fncSVMD5gg(c, d, a, b, x[i+15], 14, -660478335);
    b = fncSVMD5gg(b, c, d, a, x[i+ 4], 20, -405537848);
    a = fncSVMD5gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
    d = fncSVMD5gg(d, a, b, c, x[i+14], 9 , -1019803690);
    c = fncSVMD5gg(c, d, a, b, x[i+ 3], 14, -187363961);
    b = fncSVMD5gg(b, c, d, a, x[i+ 8], 20,  1163531501);
    a = fncSVMD5gg(a, b, c, d, x[i+13], 5 , -1444681467);
    d = fncSVMD5gg(d, a, b, c, x[i+ 2], 9 , -51403784);
    c = fncSVMD5gg(c, d, a, b, x[i+ 7], 14,  1735328473);
    b = fncSVMD5gg(b, c, d, a, x[i+12], 20, -1926607734);

    a = fncSVMD5hh(a, b, c, d, x[i+ 5], 4 , -378558);
    d = fncSVMD5hh(d, a, b, c, x[i+ 8], 11, -2022574463);
    c = fncSVMD5hh(c, d, a, b, x[i+11], 16,  1839030562);
    b = fncSVMD5hh(b, c, d, a, x[i+14], 23, -35309556);
    a = fncSVMD5hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
    d = fncSVMD5hh(d, a, b, c, x[i+ 4], 11,  1272893353);
    c = fncSVMD5hh(c, d, a, b, x[i+ 7], 16, -155497632);
    b = fncSVMD5hh(b, c, d, a, x[i+10], 23, -1094730640);
    a = fncSVMD5hh(a, b, c, d, x[i+13], 4 ,  681279174);
    d = fncSVMD5hh(d, a, b, c, x[i+ 0], 11, -358537222);
    c = fncSVMD5hh(c, d, a, b, x[i+ 3], 16, -722521979);
    b = fncSVMD5hh(b, c, d, a, x[i+ 6], 23,  76029189);
    a = fncSVMD5hh(a, b, c, d, x[i+ 9], 4 , -640364487);
    d = fncSVMD5hh(d, a, b, c, x[i+12], 11, -421815835);
    c = fncSVMD5hh(c, d, a, b, x[i+15], 16,  530742520);
    b = fncSVMD5hh(b, c, d, a, x[i+ 2], 23, -995338651);

    a = fncSVMD5ii(a, b, c, d, x[i+ 0], 6 , -198630844);
    d = fncSVMD5ii(d, a, b, c, x[i+ 7], 10,  1126891415);
    c = fncSVMD5ii(c, d, a, b, x[i+14], 15, -1416354905);
    b = fncSVMD5ii(b, c, d, a, x[i+ 5], 21, -57434055);
    a = fncSVMD5ii(a, b, c, d, x[i+12], 6 ,  1700485571);
    d = fncSVMD5ii(d, a, b, c, x[i+ 3], 10, -1894986606);
    c = fncSVMD5ii(c, d, a, b, x[i+10], 15, -1051523);
    b = fncSVMD5ii(b, c, d, a, x[i+ 1], 21, -2054922799);
    a = fncSVMD5ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
    d = fncSVMD5ii(d, a, b, c, x[i+15], 10, -30611744);
    c = fncSVMD5ii(c, d, a, b, x[i+ 6], 15, -1560198380);
    b = fncSVMD5ii(b, c, d, a, x[i+13], 21,  1309151649);
    a = fncSVMD5ii(a, b, c, d, x[i+ 4], 6 , -145523070);
    d = fncSVMD5ii(d, a, b, c, x[i+11], 10, -1120210379);
    c = fncSVMD5ii(c, d, a, b, x[i+ 2], 15,  718787259);
    b = fncSVMD5ii(b, c, d, a, x[i+ 9], 21, -343485551);

    a = fncSVSafeAdd(a, olda);
    b = fncSVSafeAdd(b, oldb);
    c = fncSVSafeAdd(c, oldc);
    d = fncSVSafeAdd(d, oldd);
  }
  return Array(a, b, c, d);
}

function fncSVMD5cmn(q, a, b, x, s, t) {
  return fncSVSafeAdd(fncSVBitRol(fncSVSafeAdd(fncSVSafeAdd(a, q), fncSVSafeAdd(x, t)), s),b);
}
function fncSVMD5ff(a, b, c, d, x, s, t) {
  return fncSVMD5cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function fncSVMD5gg(a, b, c, d, x, s, t) {
  return fncSVMD5cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function fncSVMD5hh(a, b, c, d, x, s, t) {
  return fncSVMD5cmn(b ^ c ^ d, a, b, x, s, t);
}
function fncSVMD5ii(a, b, c, d, x, s, t) {
  return fncSVMD5cmn(c ^ (b | (~d)), a, b, x, s, t);
}


function fncSVSafeAdd(x, y) {
  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  return (msw << 16) | (lsw & 0xFFFF);
}

function fncSVBitRol(num, cnt) {
  return (num << cnt) | (num >>> (32 - cnt));
}

function fncSVstr2binl(str) {
  var bin = Array();
  var mask = (1 << 8) - 1;
  for(var i = 0; i < str.length * 8; i += 8)
    bin[i>>5] |= (str.charCodeAt(i / 8) & mask) << (i%32);
  return bin;
}

function fncSVbinl2hex(binarray) {
  var hex_tab = 0 ? "0123456789ABCDEF" : "0123456789abcdef";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
  }
  return str;
}

var w = window;
if(!w.HTMLElement && (typeof document.createElement) == "function" && (t=document.createElement('a').__proto__) && t == document.createElement('p').__proto__) {
   w.HTMLElement={};
   w.HTMLElement.prototype=t;
}


if(typeof HTMLElement!="undefined" && !HTMLElement.prototype.insertAdjacentElement){
	HTMLElement.prototype.insertAdjacentElement = function(where,parsedNode)
	{
		switch (where){
		case 'beforeBegin':
			this.parentNode.insertBefore(parsedNode,this)
			break;
		case 'afterBegin':
			this.insertBefore(parsedNode,this.firstChild);
			break;
		case 'beforeEnd':
			this.appendChild(parsedNode);
			break;
		case 'afterEnd':
			if (this.nextSibling)
				this.parentNode.insertBefore(parsedNode,this.nextSibling);
			else
				this.parentNode.appendChild(parsedNode);
			break;
		}
	}

	HTMLElement.prototype.insertAdjacentHTML = function(where,htmlStr)
	{
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var parsedHTML = r.createContextualFragment(htmlStr);
		this.insertAdjacentElement(where,parsedHTML)
	}


	HTMLElement.prototype.insertAdjacentText = function(where,txtStr)
	{
		var parsedText = document.createTextNode(txtStr)
		this.insertAdjacentElement(where,parsedText)
	}
}


/* SWFObject - swf embedding */

if (typeof deconcept == "undefined") { var deconcept = new Object(); } if (typeof deconcept.util == "undefined") { deconcept.util = new Object(); } if (typeof deconcept.SWFObjectUtil == "undefined") { deconcept.SWFObjectUtil = new Object(); } deconcept.SWFObject = function(_1, id, w, h, _5, c, _7, _8, _9, _a) { if (!document.getElementById) { return; } this.DETECT_KEY = _a ? _a : "detectflash"; this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY); this.params = new Object(); this.variables = new Object(); this.attributes = new Array(); if (_1) { this.setAttribute("swf", _1); } if (id) { this.setAttribute("id", id); } if (w) { this.setAttribute("width", w); } if (h) { this.setAttribute("height", h); } if (_5) { this.setAttribute("version", new deconcept.PlayerVersion(_5.toString().split("."))); } this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(); if (!window.opera && document.all && this.installedVer.major > 7) { deconcept.SWFObject.doPrepUnload = true; } if (c) { this.addParam("bgcolor", c); } var q = _7 ? _7 : "high"; this.addParam("quality", q); this.setAttribute("useExpressInstall", false); this.setAttribute("doExpressInstall", false); var _c = (_8) ? _8 : window.location; this.setAttribute("xiRedirectUrl", _c); this.setAttribute("redirectUrl", ""); if (_9) { this.setAttribute("redirectUrl", _9); } }; deconcept.SWFObject.prototype = { useExpressInstall: function(_d) { this.xiSWFPath = !_d ? "expressinstall.swf" : _d; this.setAttribute("useExpressInstall", true); }, setAttribute: function(_e, _f) { this.attributes[_e] = _f; }, getAttribute: function(_10) { return this.attributes[_10]; }, addParam: function(_11, _12) { this.params[_11] = _12; }, getParams: function() { return this.params; }, addVariable: function(_13, _14) { this.variables[_13] = _14; }, getVariable: function(_15) { return this.variables[_15]; }, getVariables: function() { return this.variables; }, getVariablePairs: function() { var _16 = new Array(); var key; var _18 = this.getVariables(); for (key in _18) { _16[_16.length] = key + "=" + _18[key]; } return _16; }, getSWFHTML: function() { var _19 = ""; if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); this.setAttribute("swf", this.xiSWFPath); } _19 = "<embed type=\"application/x-shockwave-flash\" src=\"" + this.getAttribute("swf") + "\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\""; _19 += " id=\"" + this.getAttribute("id") + "\" name=\"" + this.getAttribute("id") + "\" "; var _1a = this.getParams(); for (var key in _1a) { _19 += [key] + "=\"" + _1a[key] + "\" "; } var _1c = this.getVariablePairs().join("&"); if (_1c.length > 0) { _19 += "flashvars=\"" + _1c + "\""; } _19 += "/>"; } else { if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); this.setAttribute("swf", this.xiSWFPath); } _19 = "<object id=\"" + this.getAttribute("id") + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\">"; _19 += "<param name=\"movie\" value=\"" + this.getAttribute("swf") + "\" />"; var _1d = this.getParams(); for (var key in _1d) { _19 += "<param name=\"" + key + "\" value=\"" + _1d[key] + "\" />"; } var _1f = this.getVariablePairs().join("&"); if (_1f.length > 0) { _19 += "<param name=\"flashvars\" value=\"" + _1f + "\" />"; } _19 += "</object>"; } return _19; }, write: function(_20) { if (this.getAttribute("useExpressInstall")) { var _21 = new deconcept.PlayerVersion([6, 0, 65]); if (this.installedVer.versionIsValid(_21) && !this.installedVer.versionIsValid(this.getAttribute("version"))) { this.setAttribute("doExpressInstall", true); this.addVariable("MMredirectURL", escape(this.getAttribute("xiRedirectUrl"))); document.title = document.title.slice(0, 47) + " - Flash Player Installation"; this.addVariable("MMdoctitle", document.title); } } if (this.skipDetect || this.getAttribute("doExpressInstall") || this.installedVer.versionIsValid(this.getAttribute("version"))) { var n = (typeof _20 == "string") ? document.getElementById(_20) : _20; n.innerHTML = this.getSWFHTML(); return true; } else { if (this.getAttribute("redirectUrl") != "") { document.location.replace(this.getAttribute("redirectUrl")); } } return false; } }; deconcept.SWFObjectUtil.getPlayerVersion = function() { var _23 = new deconcept.PlayerVersion([0, 0, 0]); if (navigator.plugins && navigator.mimeTypes.length) { var x = navigator.plugins["Shockwave Flash"]; if (x && x.description) { _23 = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")); } } else { if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0) { var axo = 1; var _26 = 3; while (axo) { try { _26++; axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + _26); _23 = new deconcept.PlayerVersion([_26, 0, 0]); } catch (e) { axo = null; } } } else { try { var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); } catch (e) { try { var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); _23 = new deconcept.PlayerVersion([6, 0, 21]); axo.AllowScriptAccess = "always"; } catch (e) { if (_23.major == 6) { return _23; } } try { axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); } catch (e) { } } if (axo != null) { _23 = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(",")); } } } return _23; }; deconcept.PlayerVersion = function(_29) { this.major = _29[0] != null ? parseInt(_29[0]) : 0; this.minor = _29[1] != null ? parseInt(_29[1]) : 0; this.rev = _29[2] != null ? parseInt(_29[2]) : 0; }; deconcept.PlayerVersion.prototype.versionIsValid = function(fv) { if (this.major < fv.major) { return false; } if (this.major > fv.major) { return true; } if (this.minor < fv.minor) { return false; } if (this.minor > fv.minor) { return true; } if (this.rev < fv.rev) { return false; } return true; }; deconcept.util = { getRequestParameter: function(_2b) { var q = document.location.search || document.location.hash; if (_2b == null) { return q; } if (q) { var _2d = q.substring(1).split("&"); for (var i = 0; i < _2d.length; i++) { if (_2d[i].substring(0, _2d[i].indexOf("=")) == _2b) { return _2d[i].substring((_2d[i].indexOf("=") + 1)); } } } return ""; } }; deconcept.SWFObjectUtil.cleanupSWFs = function() { var _2f = document.getElementsByTagName("OBJECT"); for (var i = _2f.length - 1; i >= 0; i--) { _2f[i].style.display = "none"; for (var x in _2f[i]) { if (typeof _2f[i][x] == "function") { _2f[i][x] = function() { }; } } } }; if (deconcept.SWFObject.doPrepUnload) { if (!deconcept.unloadSet) { deconcept.SWFObjectUtil.prepUnload = function() { __flash_unloadHandler = function() { }; __flash_savedUnloadHandler = function() { }; window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs); }; window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload); deconcept.unloadSet = true; } } if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }; } var getQueryParamValue = deconcept.util.getRequestParameter; var FlashObject = deconcept.SWFObject; var SWFObject = deconcept.SWFObject;

