var basehref = 'http://survey.comwerks.net/';

var UXrandomnumber=Math.floor(Math.random()*10+1);
        if(UXrandomnumber<0){
                if(!getCookie("noSurveyDays")){
                        $(document).ready(function(){
                        	$("#divSurvey").css({display:"block"});
                            $("#divSurvey").dialog({autoOpen: false, width: 686, height: 479, resizable: false, modal: true });
							$(".ui-dialog").css({'z-index':'10020'});
							$('.ui-widget-overlay').css({'z-index':'10001'});
                        });
                }
                else {
                        $(document).ready(function(){
                        $("#divSurvey").dialog({autoOpen: false, width: 686, height: 479, resizable: false, modal: true });
                        });
		}
        }
        else{
	        $(document).ready(function(){
                $("#divSurvey").dialog({autoOpen: false, width: 686, height: 479, resizable: false, modal: true });
		});
	}

function setCookie(c_name,value,expiredays)
{
        var exdate=new Date();
        exdate.setDate(exdate.getDate()+expiredays);
        document.cookie=c_name+ "=" +escape(value)+
                ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())+"; path=/";
}

function getCookie(c_name)
{
        if (document.cookie.length>0)
        {
                c_start=document.cookie.indexOf(c_name + "=");
                if (c_start!=-1)
                {
                        c_start=c_start + c_name.length+1;
                        c_end=document.cookie.indexOf(";",c_start);
                        if (c_end==-1) c_end=document.cookie.length;
                        return unescape(document.cookie.substring(c_start,c_end));
                }
        }
return "";
}

function eraseCookie(name) {
        setCookie(name,"",-1);
}

document.write('<style>'
  + '.ui-dialog-container{padding:0px;border: 1px solid #BCBCBC;background-color: #ffffff;}'
  + '.ui-dialog-overlay, .ui-widget-overlay{background:transparent url("'+basehref+'images/1x1transparent.png");filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+basehref+'images/1x1transparent.png\', sizingMethod=\'scale\');position:absolute; top:0;}'
  + '.ui-dialog-titlebar {display:none;}'
  + '#divSurvey {display:none;}'
  + '#divSurvey tr{border:none;}'
 + '</style>');

document.write(''
  + '<div id="divSurvey"><div style="width:99%;text-align:right;padding-top:8px;position:absolute;margin-right:15px"><a href="javascript:;" onclick="$(\'#divSurvey\').dialog(\'close\');return false;"><img src="'+basehref+'images/icon/icon-close.jpg" alt="Close" width="24" height="22" border="0" /></a></div><div>'
+ '<link href="'+basehref+'scripts/cw_surveys_invitation_001.css" rel="stylesheet" type="text/css" />'
  + '<table style="width: 680px" border="0" align="center" cellpadding="0" cellspacing="0">'
  + '  <tr>'
  + '    <td height="132"><table style="width: 680px"  border="0" cellspacing="0" cellpadding="0">'
  + '      <tr>'
  + '        <td><img src="'+basehref+'images/logo/digi_logo.jpg" alt="Digi" width="52" height="49" /></td>'
  + '      </tr>'
  + '    </table>'
  + '      <table style="width: 610px"  border="0" align="center" cellpadding="0" cellspacing="0">'
  + '        <tr>'
  + '          <td>&nbsp;</td>'
  + '        </tr>'
  + '        <tr>'
  + '          <td><h1 class="cw_font_color">Welcome to the Digi Website!</h1></td>'
  + '        </tr>'
  + '        <tr>'
  + '          <td>&nbsp;</td>'
  + '        </tr>'
  + '        <tr>'
  + '          <td class="cw_font_color"><h2>Your feedback is important to us</h2>'
  + '          </td>'
  + '        </tr>'
  + '                <tr>'
  + '          <td class="cw_font_color">'
  + '          After visiting our website, would you be willing to answer 8 quick questions?</td>'
  + '        </tr>'
  + '        <tr>'
  + '          <td>&nbsp;</td>'
  + '        </tr>'
  + '        <tr>'
  + '          <td class="cw_font_color"><h2>It will take less than 5 minutes</h2>'
  + '            <ul>'
  + '              <li>Click the "Yes" button below</li>'
  + '              <li>A window will <strong>open in the background</strong></li>'
  + '              <li><strong>Continue using the DiGi</strong> website as you <strong>originally</strong> intended.</li>'
  + '              <li><strong>When you\'re done</strong>, retrieve the window to <strong>finish the survey</strong>.</li>'
  + '          </ul></td>'
  + '        </tr>'
  + '        <tr>'
  + '          <td>&nbsp;</td>'
  + '        </tr>'
  + '        <tr>'
  + '          <td class="cw_font_color">Thank you for your help!</td>'
  + '        </tr>'
  + '        <tr>'
  + '          <td>&nbsp;</td>'
  + '        </tr>'
  + '        <tr>'
  + '          <td><img src="'+basehref+'images/button_g.jpg" width="195" height="38" border="0" usemap="#CWMap789" /></td>'
  + '        </tr>'
  + '        <tr>'
  + '          <td>&nbsp;</td>'
  + '        </tr>'
  + '        <tr>'
  + '        </tr>'
  + '        <tr>'
  + '          <td>&nbsp;</td>'
  + '        </tr>'
  + '      </table>'
  + ' <br /></td>'
  + '  </tr>'
  + '</table>'
  + ''
  + '<map name="CWMap789" id="CWMap789"><area shape="rect" coords="2,2,79,35" href="javascript:;" onClick="top.$(\'#divSurvey\').dialog(\'close\');top.setCookie(\'noSurveyDays\',\'45\',45);var surveyWindow=window.open(\'http://survey.comwerks.com/digi-2\');top.focus();surveyWindow.opener.focus();surveyWindow.blur();" /><area shape="rect" coords="116,2,193,37" href="javascript:;" onClick="top.$(\'#divSurvey\').dialog(\'close\');top.setCookie(\'noSurveyDays\',\'45\',45);" /></map>'
+'</div></div>');

