/*
 * jZFI JavaScript Library v1.0
 * http://www.zfi.ch
 *
 * Copyright 2011, Daniel Schmutz, ZFI 
 * http://www.zfi.ch
 *
 *
 */
function randomPassword(length, special) {
  var iteration = 0;
  var password = "";
  var randomNumber;
  if(special == undefined){
      var special = false;
  }
  while(iteration < length){
    randomNumber = (Math.floor((Math.random() * 100)) % 94) + 33;
    if(!special){
      if ((randomNumber >=33) && (randomNumber <=47)) { continue; }
      if ((randomNumber >=58) && (randomNumber <=64)) { continue; }
      if ((randomNumber >=91) && (randomNumber <=96)) { continue; }
      if ((randomNumber >=123) && (randomNumber <=126)) { continue; }
    }
    iteration++;
    password += String.fromCharCode(randomNumber);
  }
  return password;
}

function replaceAll(str, find, replace) {
	if (str == null) {
		return str;
	}
	while(true) {
		if (str.indexOf(find) < 0) {
			return str;
		}
		str = str.replace(find, replace);
	}
}

$(document).ready(function() {
	// set content wrapper height
	$('#content-wrapper').height($(this).height() - 228)
	$('#searchField').focus();
	$('#searchSubmit').click(function(e) {
		$.get('ajax/search.php', function(data) {
			$('#result-wrapper').html(data);
		});
	});
//    $("#zfi-dialog").dialog();
	$(this).resize(function(e) {
//		alert("resize");
	});
	adbar.start();
});

function ajaxGetParam(txt, key) {
	var startKey = "<!--" + key + ":";
	var start = txt.indexOf(startKey);
	var end = txt.indexOf(":" + key + "-->");
	var value = txt.substr(start + startKey.length, end - (start + startKey.length));
	return value;
}

