var newWin = null;
function popUp(strURL, strType, strHeight, strWidth) {
  if (newWin != null && !newWin.closed)
    newWin.close();
    var strOptions="";
  if (strType=="popup")
    strOptions="location=0,menubar=1,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,height="+strHeight+",width="+strWidth;
  newWin = window.open(strURL, 'newWin', strOptions);
  newWin.focus();
}
//Function for expanding or collapsing a chosen tag in the XSL template
function expand(thistag) {
  if(document.getElementById(thistag)){
    styleObj = document.getElementById(thistag).style;
    if (styleObj.display=='none') {styleObj.display = '';}
  else {styleObj.display = 'none';}
  }
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function externalLinks(){
  if (!document.getElementsByTagName) return;
  var anchors = document.getElementsByTagName("a");
  for(var i=0;i<anchors.length; i++){
    var anchor = anchors[i];
    if(anchor.getAttribute("href") && anchor.getAttribute("rel") == "external"){
      anchor.target = "_blank";
    }
  }
}
/*
  Method: pollValidate
  
  Validation for a poll.
  
  Parameters:
  
    formId - String, form/@id.
*/
function pollValidate(formId) {
  var form = document.getElementById(formId)
  var el = form.elements;
  var checked = false;
  for (var i = 0; i < el.length; i++) {
    if (el[i].checked == true)
      checked = true;
  }
  if (!checked) {
    if (formHasType(form, 'checkbox'))
      alert('You have to select at least one alternative first!');
    else 
      alert('You have to select an alternative first!');
  } else {
    form.submit();
  }
} 

/*
  Function: pollIsMultiple
  
  Checks if the form has an element with the given type.
  
  Parameters:
  
    form - Object, HTMLFormElement.
    typeName - String, type name.  

  Returns:
  
    true || false
*/
function formHasType(form, typeName) {
  var hasType = false;
  for (var i = 0; i < form.elements.length; i++) {
    if (form.elements[i].type == typeName) {
      hasType = true;
      break;
    }
  }
  return hasType;
}

     function loadPerson(urlin){
                var url = urlin + ' #person_details';
                $("#detail").hide();
                $("#detail").load(url).show();
               
               
               window.document.body.scrollTop = 0;
                window.document.documentElement.scrollTop = 0;
               }
function concatEM(_name,host){
    document.location.href = 'mailto: '+_name+'@'+host;
}