// usage <body onload="focusFirstField(document.form1)">
function focusFirstField(oForm){
	for(var i=0; i<oForm.elements.length; i++){
		if(oForm.elements[i].type == "text") { //koll att det är textfält
			oForm.elements[i].focus();
			break;
		}
	}
}

function focusFirstSelect(oForm){
	for(var i=0; i<oForm.elements.length; i++){
		if(oForm.elements[i].type == "select") { //koll att det är select
			oForm.elements[i].focus();
			break;
		}
	}
}

function viewRules(type){
var url = '/NewAd/Rules/'+ type +'.php'; window.open(url,'viewRules','width=600,height=600,menubar=no,scrollbars=yes,toolbar=no,location=no,directories=no,resizable=yes,top=0,left=0');
}

function ManagePictures(adid){
var url = '/Members/ManagePicture.php?id='+ adid +''; window.open(url,'ManagePictures','width=550,height=600,menubar=no,scrollbars=yes,toolbar=no,location=no,directories=no,resizable=yes,top=0,left=0');
}

function ManageArticlePictures(articleid){
var url = '/Members/ManageArticlePicture.php?id='+ articleid +''; window.open(url,'ManagePictures','width=550,height=600,menubar=no,scrollbars=yes,toolbar=no,location=no,directories=no,resizable=yes,top=0,left=0');
}


function refresh(){
    window.location.reload( false );
}

function goThere(selObj) {
  selVal = selObj.options[selObj.selectedIndex].value;
  if(selVal != "") {
    if(selVal.indexOf("|") != -1) {
	  t = selVal.substring(selVal.indexOf("|")+1,selVal.length);
	  val = selVal.substring(0,selVal.indexOf("|"));
	  if(t == "blank"){
	    window.open(val,'menuWin');
	  } else if(t == "top"){
		window.location = val;
	  } else {
		fraTarget = eval("parent." + t + ".document");
		fraTarget.location = val;
	  }
	} else {
	  window.location = selVal;
	}
  }
}