// start create target blank from class="blank"

function addEvent(obj, evType, fn) {
	if (obj.addEventListener) {
		obj.addEventListener(evType, fn, true);
		return true;
	} else if (obj.attachEvent) {
		var r = obj.attachEvent("on"+evType, fn); 
		return r;
	} else {
		return false;
	}
}

function getlinks() {
	var links = document.getElementsByTagName('A');
	for (var i = 0; i < links.length; i++) {
		if (/nolink/.exec(links[i].href)) {
			links[i].onclick = linkinfo;
		}
	}
}
function linkinfo() {
	alert('Denna länk är inte aktiv i prototypen.');
	return false;
}

addEvent(window, 'load', getlinks);



function validate(thisObj){
  if(thisObj.company.value==''){
  	alert('Du måste ange en avsändare');
  	thisObj.company.focus();
  	return false;
  }
  return true;
}


function showSubmenu(menuObj, linkObj){
  resetAll();
  tmpObj = document.getElementById(menuObj);
  if(tmpObj){
	tmpObj.style.display = 'block';
  }
  linkObj.className = 'sel';
  linkObj.blur(); 
  return false;
}

function resetAll(){
	for (var x = 0; x <= 10; x++){
		tmpObj2 = document.getElementById('t' + x);
		if(tmpObj2){
			tmpObj2.className = '';
		}
		tmpObj3 = document.getElementById('sub' + x);
		if(tmpObj3){
			tmpObj3.style.display = 'none';
		}
	}
}

function openInfo(theURL,winName) { 
	window.open(theURL,winName,'width=550,height=450,titelbar=1,scrollbars=1,status=0,toolbar=0');
	return false;
}

function openLogin(theURL,winName) { 
	window.open(theURL,winName,'width=550,height=380,titelbar=1,scrollbars=1,status=0,toolbar=0');
	return false;
}

function previewPostcard(theURL,winName) { 
	window.open(theURL,winName,'width=780,height=480,titelbar=1,scrollbars=1,status=0,toolbar=0');
	return false;
}



