﻿var mobileVer = false;

var numArray = false;
var is_ascii_warning = 0;
var inproces = false;
var pageTracker;
var numCombo;
var useoldnumto = false;
var sendsmsmode = 'free';
var iphone = false;
var not_clear_msg=false;
var phoneOnBlur=false;
var codeTime = new Date();
var debugIsLoad=false;

function $(el){
  return document.getElementById(el);
}
function createCookie(name, value ,days) {
   if (days) {
      var date = new Date();
      date.setTime(date.getTime()+(days*24*60*60*1000));
      var expires = "; expires="+date.toGMTString();
   }
   else var expires = "";
   document.cookie = name+"="+encodeURIComponent(value)+expires+"; path=/";
}
function readCookie(name) {
   var nameEQ = name + "=";
   var ca = document.cookie.split(';');
   for(var i=0;i < ca.length;i++) {
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1,c.length);
      if (c.indexOf(nameEQ) == 0) return decodeURIComponent(c.substring(nameEQ.length,c.length));
   }
   return null;
}

function onLoad(){
  debugIsLoad=true;
  
  /// google analistic
  if (typeof(_gat) == "object") { 
    pageTracker = _gat._getTracker("UA-3287250-4");
    pageTracker._setVar(ip_address);
    pageTracker._trackPageview("");
  }
  
  if(typeof(processOnLoad) == "undefined"){
    return false;
  }
  
  if (!readCookie('teltel')){
    //createCookie('teltel','1',190); 
    //window.open ("http://www.teltel.lv","mywindow");
  }
  
  if (mobileVer||login==0)  useoldnumto=1;
  //if (!mobileVer) as_clickInit();
  
  if (useoldnumto==0){ 
    try  {
      window.dhx_globalImgPath="/static/dhtmlxCombo/codebase/imgs/";
      numCombo =new dhtmlXCombo("iphone_combo","alfa3",285);
      numCombo.attachEvent("onBlur", 'iphoneBlur');
      numCombo.attachEvent("onOpen", function(){
        numCombo.setComboText('');
      });
      
      /// set combobox values
      $('comboInput').focus();
      $('comboInput').setAttribute("MAXLENGTH",25);
      $('comboInput').setAttribute("TABINDEX",1);
      if (navigator.userAgent.indexOf('iPhone')!=-1)
        $('comboInput').setAttribute("TYPE",'number');
      
      setNumArray();         
      numCombo.enableFilteringMode(true);
      }
    catch(err){         
       useoldnumto=1;
    }
  }

  if (useoldnumto){
    if (navigator.userAgent.indexOf('iPhone')!=-1)
      $('iphone').setAttribute("TYPE",'number');
    $('iphone').style.display='block';
    $('iphone').focus();
    $('iphone_combo').style.display='none';
    if (!login){
      $('btnAddContact').style.display='none';
      $('btnRemoveContact').style.display='none';
    }
  } else {
    $('iphone').style.display='none';
  }

  if (login==0){
    if (readCookie('ifrom')) 
      $('ifrom').value = readCookie('ifrom');
  }
 
  //load values from cookie
  if (readCookie('c_phone')){ 
    if (useoldnumto)  $('iphone').value = readCookie('c_phone');
    else numCombo.setComboText(readCookie('c_phone'));
    checkCountry(readCookie('c_phone'));
  }
  if (readCookie('c_text')) $('itext').value = readCookie('c_text');
  textCounter('itext');
  
}

function dontShowTitleClick(id, dont_show){
  if (dont_show)
    createCookie('dont_show_title',id, 20);
  else createCookie('dont_show_title',0, 0);
  document.location='title';
}

function iphoneBlur(){
  var iphone = getPhone(true);
  checkCountry(iphone);
  showCode();
  phoneOnBlur=iphone;
}

function btnAddContactClick(){
  if (login==0) {
    alert(msg_address_book_please_login);
  } else 
  iphone = getPhone();
  if (!iphone) return false;
  if (iphone.substring(0, 1)!='+') return false;
  if (!useoldnumto){
    var name=window.prompt(msg_enter_contact_name,"");
    if (name){
      name = name.replace('[','(');
      name = name.replace(']',')');
      numArray.push(name +' ['+iphone+']');
      setNumArray();
      saveNumArray();
      numCombo.setComboText(name +' ['+iphone+']');
    }
  }
}
function btnRemoveContactClick(){
  if (login==0) {
    alert(msg_address_book_please_login);
  } else 
  if ((numArray)&&(!useoldnumto)){
    for (i in numArray) { 
       if (numArray[i] == numCombo.getComboText()){
          if (confirm(msg_delete_contact)) { 
            numArray.splice(i,1);
            setNumArray();
            saveNumArray();
          }
       }
    }
  }
}

function setNumArray(){
  numCombo.clearAll();
  numCombo.setComboText('');
  if (numArray===false){
    if (numArrayJson)
      numArray=JSON.decode(numArrayJson);
    else numArray = new Array();
  }
  
  for(var i=0; i<numArray.length; i++){
    numCombo.addOption(new Array([ i, numArray[i] ]));
  }
}

function saveNumArray(){
   showAjaxLoader(true);
   $('icmd').value='SAVE_NUM';
   //$('icmd_value').value=numArray.join("%^%");
   $('icmd_value').value= JSON.encode(numArray);
   $('formsend').submit();
}

function IsNumeric(sText){
      var ValidChars = "0123456789.";
      var IsNumber=true;
      var Char;
      if (sText=='') return false;
      for (i = 0; i < sText.length && IsNumber == true; i++) 
         { 
         Char = sText.charAt(i); 
         if (ValidChars.indexOf(Char) == -1) 
            {
            IsNumber = false;
            }
         }
      return IsNumber;
}

function disableEnterKey(e){
     var key;
     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox
     if(key == 13){
          return false;
          }
     else
          return true;
}

function msg(text, color){
   $('ajaxLoader').style.display = "none";
   $('ajaxMessage').style.display = "inline";
   $('ajaxMessage').innerHTML='<font color="'+color+'">'+text+'</font>';
}

function showAjaxLoader(show) {
  $('ajaxLoader').style.display = "block";
  $('ajaxMessage').style.display = "none";
  if (!show){
    $('ajaxMessage').style.display = "inline";
    $('ajaxLoader').style.display = "none";
    if (!not_clear_msg) msg('','red');
    not_clear_msg=false;
  }
}

function showCode(){
  var iphone = getPhone(true);
  $('icode').value = '';
  if (iphone && sendsmsmode=='free' && use_chapcha && iphone.substring(0,5)=='+3712' && iphone.length==12){
    codeTime = new Date();
    showAjaxLoader(true);
    inproces=1;
    var url='showcode?phone='+encodeURIComponent(iphone)+"&" + Math.random();
    $('codeArea').style.display = "block";
    $('codeimage').innerHTML='';
    $('codeimage').innerHTML='<img src="'+url+'" height="50" style="border: 1px solid #A8ABB8; max-width: 208px;" onClick="javascript:showCode()" onLoad="codeImg(1)" onError="codeImg(2)" class="hand">';
  } else $('codeArea').style.display='none';
}

function codeImg(val){
  inproces=0;
  showAjaxLoader(false);
  if (val!=1) $('codeArea').style.display='none';
}

function response(cmd, ajaxRes){
  inproces=0;
  showAjaxLoader(false);  
  phoneOnBlur=false;
  
  if (cmd=='SEND_SMS') {
    not_clear_msg=true;
    iphoneBlur();
    if (ajaxRes=='sent') {
       createCookie('c_text', '', 0);
       createCookie('c_phone', '', 0);
       msg(msg_sms_sent,'green');
       $('immsfile').value='';
       //$('iphone').value='';
       //if (!useoldnumto) setNumArray();
       $('itext').value=''; 
       createCookie('sms_is_sent','1',99); 
    }
    else if (ajaxRes=='limit') msg(msg_limit_sent,'blue');
    else if (ajaxRes=='error') msg(msg_error,'red');
    else if (ajaxRes=='wrong_code') msg(msg_wrong_code,'red'); 
    else if (ajaxRes=='phone_not_allow') msg(msg_number_not_allow,'blue'); 
    else if (ajaxRes=='busy') msg(msg_smsbusy,'red');
    else if (ajaxRes=='wrong_number_format') msg(msg_wrongNumber,'blue');
    else if (ajaxRes=='need_login') msg(msg_need_login,'blue');
    else if (ajaxRes=='no_credit') msg(msg_no_credit,'blue');
    else if (ajaxRes=='wrong_from_address') msg(msg_wrong_from_address,'red');
    else if (ajaxRes=='file_to_large') msg(msg_file_to_large,'red');
    else if (ajaxRes=='not_free') msg(msg_not_free,'blue');
    else if (ajaxRes=='server_down') msg($('priceboxCountry').innerHTML+' '+msg_server_down,'red');
    else if (ajaxRes=='limit_please_contact_us') msg('Limit, to increase count please contact us','red');
    else if (ajaxRes=='not_active') msg('LMT abonements nav aktivizējis sms no interneta','blue');
    else msg(msg_error,'red');
  } 
  else if (cmd=='SAVE_NUM') return false;
  else msg(msg_error,'red');

  /// google analistic
  pageTracker._trackPageview('response-'+cmd+'-'+ajaxRes);
}
function getPhone(warning){
  createCookie('c_phone', '', 0.1);
  createCookie('sms_premium', '1',2);
  var warning=!warning;
  if (!useoldnumto){
      $('iphone').value = numCombo.getComboText();
      var iphone = $('iphone').value.split(' [')[1];
      if (iphone){
        iphone = iphone.split(']')[0];
        if (iphone) $('iphone').value = iphone;
      }
  }
  
  //} else if (warning && (iphone.length!=8 || iphone.substring(0, 1)!='2')){
  
  var iphone = $('iphone').value;
  var updatePhone = false;
  if (iphone.length==0){
    if (warning) alert(msg_enter_phone_number);
    return false
  } 
  if (iphone.length<6 || iphone.length>15){
    if (warning) alert(msg_wrongNumber);
    return false
  } 
  
  if (iphone.substring(0, 2)=='00'){
    iphone = '+'+ iphone.substring(2, 99);
    updatePhone = true;
  }
  
  if (iphone.substring(0, 1)!='+'){
    iphone = default_country_code+iphone;
    // for uk remove 0
    if (default_country_code=='+44') iphone=iphone.replace('+440','+44');
    updatePhone = true;
  } 
  //alert(iphone);
  if (iphone.substring(0, 1)!='+'){
    if (warning)  alert(msg_wrongNumber); 
    return false
  }
  
  if (!IsNumeric(iphone.substring(1, 15))){
    if (warning)  alert(msg_wrongNumber); 
    return false
  }
  
  if (updatePhone) {
    $('iphone').value = iphone;
    if (!useoldnumto) numCombo.setComboText(iphone);
  }
  createCookie('c_phone', iphone, 0.1);
  return iphone;
}

function sendBtn(){
  textCounter('itext');
  if (debugIsLoad==false) pageTracker._trackPageview('debug-not-loaded');
  createCookie('ifrom', $('ifrom').value, 30);
  var iphone = getPhone();
  $('icmd_value').value = sendsmsmode;
  if (!iphone) return false;
  if (inproces==1) {
    alert(msg_please_wait);
    return false;
  } else if ($('itext').value.length==0) {
    alert(msg_noText);
  } else if (!sms_unicode && isUnicode($('itext').value)) {
    alert(msg_use_only_ascii);
  } else if ($('codeArea').style.display == "block" && !$('icode').value) alert(msg_enter_code);
    else if (sendsmsmode=='premium' && login!=1) alert(msg_not_free_need_login);
    else if (sendsmsmode=='premium' && isUnicode($('ifrom').value)) alert(msg_use_only_ascii);
    else {
      if ((Math.floor(Math.random()*50)==99999) && !readCookie('dr-say') && readCookie('sms_is_sent')){
        alert('Vispirms iesaki saviem draugiem smsbox :)');
        DraugiemSay();
        createCookie('dr-say','ok',90); 
        return false;
      }
      // need regenerate code
      if (($('codeArea').style.display == "block") && (((new Date().getTime()-codeTime.getTime())/1000/60)>10 || phoneOnBlur!=iphone)) {
        alert(msg_enter_code);
        iphoneBlur();
        pageTracker._trackPageview('debug-manualPhoneOnBlur');
        return false;
      }
      is_ascii_warning = 0;
      inproces=1;
      $('icmd').value='SEND_SMS';
      showAjaxLoader(true);
      $('formsend').submit();
  }
}
/*
function numFromNrKeyUp(){
   if(!IsNumeric(form.numFromNr.value)){
      alert(msg_enter_numeric);
   }
}
*/
function textCounter(field) {
  

  if (field=='itext' && !is_ascii_warning){
   if (!sms_unicode && isUnicode($('itext').value)) {
    is_ascii_warning=1;
    alert(msg_use_only_ascii);
   }
  }
    
  if (sendsmsmode=='free') {
    var maxlen = maxchars;
    if (isUnicode($('itext').value)) maxlen = 60;
    textLen =( $('itext').value.length + $('ifrom').value.length);
    if (textLen > maxlen) {
      if (field=='itext')
         $('itext').value= $('itext').value.substring(0, maxlen-$('ifrom').value.length);
      if (field=='ifrom')
         $('ifrom').value= $('ifrom').value.substring(0, maxlen-$('itext').value.length);
    }
    $('textCount').innerHTML = maxlen - ( $('itext').value.length + $('ifrom').value.length);
  }
  
  if (sendsmsmode=='premium') {
    var  maxlen = maxchars_ww;
    if (isUnicode($('itext').value)) maxlen = 70;
    
    if ($('ifrom').value.length>11){
      if  ( ($('ifrom').value.substring(0,1)=='+' && IsNumeric($('ifrom').value.substring(1,$('ifrom').value.length))) || IsNumeric($('ifrom').value)) 
        $('ifrom').value=$('ifrom').value.substring(0, 13);
      else $('ifrom').value= $('ifrom').value.substring(0, 11);
    };
    
    $('itext').value= $('itext').value.substring(0, maxlen);
    $('textCount').innerHTML = maxlen - $('itext').value.length;
  }
}

function wopen( url, target, w, h, res ) {
   if( !target ) target = '_blank';
   if( !w ) w = 500;
   if( !h ) h = 400

   w = parseInt( w, 10 );
   h = parseInt( h, 10 );
   

   var aw = screen.availWidth;
   var ah = screen.availHeight;
   if( w > aw ) w = aw;
   if( h > ah ) h = ah;

   if( res )r = 0; else r = 1;

   var left = Math.round( ( aw - w ) / 2 );
   var top = Math.round( ( ah - h ) / 2 );

   var wd = window.open( url, target, 'channelmode= 0, directories=0, height='+h+'px, width='+w+'px, location=0, menubar=0, resizable='+r+', scrollbars=1, status=0, toolbar=0, top='+top+'px, left='+left+'px' );
   
   return wd; 
}
function premiumModeClick(){
  var premiumMode = readCookie('premiumMode');
  if (login==1 || premiumMode==1){
    if (premiumMode==1) premiumMode=0;
    else {
      premiumMode =1;
      if (credit<0.01){
        alert(msg_no_credit);
        return false;
      }
    }
    createCookie('premiumMode',premiumMode,900);
    premiumMode = readCookie('premiumMode');
    //checkCountry(getPhone());
    //showCode();
    iphoneBlur();
  } else alert(msg_please_login);
  
  textCounter('itext');
}

function checkCountry(phone){
  $('pricebox').style.display = 'none';
  if (!phone) return false;
  var country = phone2country(phone);
  premiumMode = readCookie('premiumMode');
  if (login!=1) premiumMode=0;
  createCookie('premiumMode',premiumMode,900);
  
  if (country){
    $('pricebox').style.display = 'inline';
    $('priceboxCountry').innerHTML = country.name;
    $('priceboxPrice').innerHTML = country.price;
    $('priceboxChange').style.display='none';
    sendsmsmode = 'premium';
    
    if (country.code in topar(free_country_list)){
      $('priceboxChange').style.display='inline';
      if (premiumMode!=1){
        $('priceboxPrice').innerHTML = '<span class="green">0 Free</span>';
        sendsmsmode = 'free';
      }
      if (premiumMode==1 && login==1 && credit<country.price) alert(msg_no_credit);
    } 
    
    // check credit
    if (sendsmsmode=='premium' && login==1 && credit<country.price) alert(msg_no_credit)
    /*
    if (!(country.code in topar(free_country_list))){
      if (login!=1)
        alert(msg_not_free_need_login)
      else if (credit<country.price)
        alert(msg_no_credit)
    }
    */
    
  } else alert(msg_wrong_number_format)
}

function phone2country(phone){
  if (!phone) return false;
  if (phone.substring(0,1)!='+') return false;
  var arr_tmp = eval(countryListJson);
  if (arr_tmp.length==0) return false;
  var arr_tmpnew = Array();
  var isPhone = false;
  for (var cnt=1; cnt<8;cnt++){
    var find = '+'+phone.substring(1,cnt+1);
    for(var i=0; i<arr_tmp.length; i++){
      if (arr_tmp[i].code == find) isPhone = arr_tmp[i];
      else if ( (arr_tmp[i].code).length>cnt+1) arr_tmpnew.push(arr_tmp[i]);
    }
    if (arr_tmpnew.length<1) break;
    arr_tmp = arr_tmpnew;
    arr_tmpnew =Array();
    
  }
  return isPhone;
}

function pay(type){
  if (type=='paypal'){
    if ($('paypal_amount').value < 1) {alert(msg_min_payment+ ' EUR 1'); return 0;} 
    $('paypal_frm').submit();
  }
  if (type=='haba'){
    if ($('haba_input_sum').value < 1) {alert(msg_min_payment+' LVL 1'); return 0;} 
    $('haba_sum').value=$('haba_input_sum').value;
    alert('Jūsu kontu papildināsim 24 stundu laikā, parasti 1h laikā.')
    $('form_haba').submit();
  }
}
function isUnicode(str) {
   var unicodeFlag = 0;
   var extraChars = 0;

   for (var i = 0; (i < str.length); i++) {
      if ((str.charAt(i) >= '0') && (str.charAt(i) <= '9')) {
      }
      else if ((str.charAt(i) >= 'A') && (str.charAt(i) <= 'Z')) {
      }
      else if ((str.charAt(i) >= 'a') && (str.charAt(i) <= 'z')) {
      }
      else if (str.charAt(i) == '@') {
      }
      else if (str.charCodeAt(i) == 0xA3) {
      }
      else if (str.charAt(i) == '$') {
      }
      else if (str.charCodeAt(i) == 0xA5) {
      }
      else if (str.charCodeAt(i) == 0xE8) {
      }
      else if (str.charCodeAt(i) == 0xE9) {
      }
      else if (str.charCodeAt(i) == 0xF9) {
      }
      else if (str.charCodeAt(i) == 0xEC) {
      }
      else if (str.charCodeAt(i) == 0xF2) {
      }
      else if (str.charCodeAt(i) == 0xC7) {
      }
      else if (str.charAt(i) == '\r') {
      }
      else if (str.charAt(i) == '\n') {
      }
      else if (str.charCodeAt(i) == 0xD8) {
      }
      else if (str.charCodeAt(i) == 0xF8) {
      }
      else if (str.charCodeAt(i) == 0xC5) {
      }
      else if (str.charCodeAt(i) == 0xE5) {
      }
      else if (str.charCodeAt(i) == 0x394) {
      }
      else if (str.charAt(i) == '_') {
      }
      else if (str.charCodeAt(i) == 0x3A6) {
      }
      else if (str.charCodeAt(i) == 0x393) {
      }
      else if (str.charCodeAt(i) == 0x39B) {
      }
      else if (str.charCodeAt(i) == 0x3A9) {
      }
      else if (str.charCodeAt(i) == 0x3A0) {
      }
      else if (str.charCodeAt(i) == 0x3A8) {
      }
      else if (str.charCodeAt(i) == 0x3A3) {
      }
      else if (str.charCodeAt(i) == 0x398) {
      }
      else if (str.charCodeAt(i) == 0x39E) {
      }
      else if (str.charCodeAt(i) == 0xC6) {
      }
      else if (str.charCodeAt(i) == 0xE6) {
      }
      else if (str.charCodeAt(i) == 0xDF) {
      }
      else if (str.charCodeAt(i) == 0xC9) {
      }
      else if (str.charAt(i) == ' ') {
      }
      else if (str.charAt(i) == '!') {
      }
      else if (str.charAt(i) == '\"') {
      }
      else if (str.charAt(i) == '#') {
      }
      else if (str.charCodeAt(i) == 0xA4) {
      }
      else if (str.charAt(i) == '%') {
      }
      else if (str.charAt(i) == '&') {
      }
      else if (str.charAt(i) == '\'') {
      }
      else if (str.charAt(i) == '(') {
      }
      else if (str.charAt(i) == ')') {
      }
      else if (str.charAt(i) == '*') {
      }
      else if (str.charAt(i) == '+') {
      }
      else if (str.charAt(i) == ',') {
      }
      else if (str.charAt(i) == '-') {
      }
      else if (str.charAt(i) == '.') {
      }
      else if (str.charAt(i) == '/') {
      }
      else if (str.charAt(i) == ':') {
      }
      else if (str.charAt(i) == ';') {
      }
      else if (str.charAt(i) == '<') {
      }
      else if (str.charAt(i) == '=') {
      }
      else if (str.charAt(i) == '>') {
      }
      else if (str.charAt(i) == '?') {
      }
      else if (str.charCodeAt(i) == 0xA1) {
      }
      else if (str.charCodeAt(i) == 0xC4) {
      }
      else if (str.charCodeAt(i) == 0xD6) {
      }
      else if (str.charCodeAt(i) == 0xD1) {
      }
      else if (str.charCodeAt(i) == 0xDC) {
      }
      else if (str.charCodeAt(i) == 0xA7) {
      }
      else if (str.charCodeAt(i) == 0xBF) {
      }
      else if (str.charCodeAt(i) == 0xE4) {
      }
      else if (str.charCodeAt(i) == 0xF6) {
      }
      else if (str.charCodeAt(i) == 0xF1) {
      }
      else if (str.charCodeAt(i) == 0xFC) {
      }
      else if (str.charCodeAt(i) == 0xE0) {
      }
      else if (str.charCodeAt(i) == 0x391) {
      }
      else if (str.charCodeAt(i) == 0x392) {
      }
      else if (str.charCodeAt(i) == 0x395) {
      }
      else if (str.charCodeAt(i) == 0x396) {
      }
      else if (str.charCodeAt(i) == 0x397) {
      }
      else if (str.charCodeAt(i) == 0x399) {
      }
      else if (str.charCodeAt(i) == 0x39A) {
      }
      else if (str.charCodeAt(i) == 0x39C) {
      }
      else if (str.charCodeAt(i) == 0x39D) {
      }
      else if (str.charCodeAt(i) == 0x39F) {
      }
      else if (str.charCodeAt(i) == 0x3A1) {
      }
      else if (str.charCodeAt(i) == 0x3A4) {
      }
      else if (str.charCodeAt(i) == 0x3A5) {
      }
      else if (str.charCodeAt(i) == 0x3A7) {
      }
      else if (str.charAt(i) == '^') {
         extraChars++;
      }
      else if (str.charAt(i) == '{') {
         extraChars++;
      }
      else if (str.charAt(i) == '}') {
         extraChars++;
      }
      else if (str.charAt(i) == '\\') {
         extraChars++;
      }
      else if (str.charAt(i) == '[') {
         extraChars++;
      }
      else if (str.charAt(i) == '~') {
         extraChars++;
      }
      else if (str.charAt(i) == ']') {
         extraChars++;
      }
      else if (str.charAt(i) == '|') {
         extraChars++;
      }
      else if (str.charCodeAt(i) == 0x20AC) {
         extraChars++;
      }
      else {
         unicodeFlag = 1;
      }
   }

   if (unicodeFlag) 
   return 1;
   else return 0;
}

function topar(a)
{
  var o = {};
  for(var i=0;i<a.length;i++)
  {
    o[a[i]]='';
  }
  return o;
}


function DraugiemSay(){
 pageTracker._trackPageview("dr-civ-click");
 title='YouTube';
 //title='Dauzi kasti!';

 url='http://www.youtube.com/watch?v=N0Lc41N6Yy4';
 titlePrefix ='www.smsBox.lv';
 
 window.open(
  'http://www.draugiem.lv/say/ext/add.php?title=' + encodeURIComponent( title ) +
  '&link=' + encodeURIComponent( url ) +
  ( titlePrefix ? '&titlePrefix=' + encodeURIComponent( titlePrefix ) : '' ),
  '',
  'location=1,status=1,scrollbars=0,resizable=0,width=530,height=400'
 );
 return false;
}

function DraugiemSay2(){
 pageTracker._trackPageview("dr-askbox-click");
 title='Iečeko, atbildes uz visiem jautājumiem, par brīvu :)';


 url='http://www.AskBox.lv';
 titlePrefix ='AskBox.lv';
 createCookie('DraugiemSay2', 1,55);
 
 window.open(
  'http://www.draugiem.lv/say/ext/add.php?title=' + encodeURIComponent( title ) +
  '&link=' + encodeURIComponent( url ) +
  ( titlePrefix ? '&titlePrefix=' + encodeURIComponent( titlePrefix ) : '' ),
  '',
  'location=1,status=1,scrollbars=0,resizable=0,width=530,height=400'
 );
 return false;
}

