// STANDARD FUNCTIONS
function newWindowEasy(location,width,height,toolbar,adress)    {
window.open(location,'Halmstad','width='+width+',height='+height+',menubar='+toolbar+',location='+adress+',toolbar='+toolbar) ;
}

function setFocus(obj)   {
document.getElementById(obj).value="";
document.getElementById(obj).style.color="#000000";
}

function clrForm(formName)  {
document.forms[formName].reset()
}

function checkfield(id) {
var numericExpression = /^[0-9]+$/;
    if (document.getElementById(id).value.match(numericExpression)) {
    }
    else {
    alert("endast siffror");
    document.getElementById(id).value= "1"
    return false;
    }
    
}


//AJAX
function UseAjax(SendTxt,File,FieldToShowIn,img,FieldToView)    {
//alert(File+SendTxt);
document.getElementById(FieldToShowIn).innerHTML="<img src='ishop/images/"+img+"' align='center'>";
var xmlhttp
{
if (SendTxt.length==0)
  {
  document.getElementById(FieldToShowIn).innerHTML="";
  return;
  }
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support XMLHTTP!");
  return;
  }
var url
url=File+SendTxt
//alert(url);
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
  {
  if (FieldToShowIn =='hiddenModalContent')
  {
    //alert(xmlhttp.responseText)
    document.getElementById(FieldToShowIn).innerHTML=xmlhttp.responseText;
  }
  else
  //alert(xmlhttp.responseText)
  document.getElementById(FieldToShowIn).innerHTML=xmlhttp.responseText;
  }
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

}


