// Eliminerer feilmeldinger for JavaScript
//<script language='javascript' type='text/javascript'>
//function errorHandler(){ return true }
//window.onerror = errorHandler
//-->
//</script>

//ÅPNE VINDU START
function fncOpenWin(argAdr,argWinName,argParam){
	var varVindu = window.open(argAdr,argWinName,argParam);
	return false;
}
//ÅPNE VINDU SLUTT

//KONVERTERING E-POSTADRESSE START
function fncSendEpost(argAdr){
	var varAdr = argAdr.replace("[a]","@");
	var varVindu = window.open("","epostvindu","width=200,height=200,toolbar=no,directories=no,menubar=no,resizable=no");
	x=varVindu.document; 
	x.write("<html><head><scri"+"pt>") 
	x.write("function sendEpost(){") 
	x.write("x=document."+"all;") 
	x.write("document.locatio"+"n.href=") 
	x.write("'mailto:"+varAdr+"';") 
	x.write("self.clos"+"e();") 
	x.write("};document.title='1. Ski epostadresse';</scrip"+"t></head>") 
	x.write("<body topmargin=0 leftmargin=0 scroll=no onLoad='sendEpost()'>") 
	x.write("<div align='center'><table border=0 width='100%' height='100%'><tr><td align=center style='color: #c0c0c0; font-size: 24pt'>Et øyeblikk...</td></tr></table></div>") 
	x.write("</body></html>") 
	x.close() 
	return true;
}
//KONVERTERING E-POSTADRESSE SLUTT

//POP UP VINDU MED DYNAMISK TILPASSNING TIL BILDE START
function dynamicPopup(foto) { 
	alpha=window.open("","DynaWin"," toolbar=no,directories=no,menubar=no,resizable=no"); 
	x=alpha.document; 
	x.write("<html><head><SCRI"+"PT>") 
	x.write("function dynamicResize(){") 
	x.write("window.resizeTo(") 
	x.write("document.im1.width+11,") 
	x.write("document.im1.height+29);") 
	x.write("};document.title='1. Ski fotoalbum';</SCRIP"+"T></head>") 
	x.write("<body topmargin=0 leftmargin=0 scroll=no>") 
	x.write("<img src='"+foto+"' name='im1' onLoad='dynamicResize()'>") 
	x.write("</body></html>") 
	x.close() 
	alpha.focus() 
}
//POP UP VINDU MED DYNAMISK TILPASSNING TIL BILDE SLUTT

//POP UP VINDU MED FOR RADIOSENDINGER
function radioOB() { 
	alpha=window.open("/php/radio_ab.php","RadioOB","innerHeight=450,height=450,innerWidth=425,width=425,status=no,toolbar=no,directories=no,menubar=no,resizable=no,scrollbars=yes"); 
	alpha.focus() 
}
//POP UP VINDU MED DYNAMISK TILPASSNING TIL BILDE SLUTT

//MELDING PÅ STATUSLINJEN START
function displayStatusMsg(msgStr)  {
	status=msgStr;
	document.returnValue = true;
}
function showStatus(text){
	window.returnValue = true;
	window.setTimeout("window.status='" + text + "'", 2);
}

//MELDING PÅ STATUSLINJEN slutt

//NULLSTILLE MELDING PÅ STATUSLINJEN START
displayStatusMsg('');
//NULLSTILLE MELDING PÅ STATUSLINJEN SLUTT

//FUNKSJONER FOR KNAPPER
function button_over(eButton){
//	eButton.style.backgroundColor 	= '#CC0000';
	eButton.style.backgroundColor 	= '#C1D2EE';
	eButton.style.borderColor 		= 'darkblue darkblue darkblue darkblue';
	eButton = null; 
}

function button_out(eButton){
//	eButton.style.backgroundColor 	= '#EFEFEF';
	eButton.style.backgroundColor 	= '';
	eButton.style.borderColor 		= '#DDDDDD #DDDDDD #DDDDDD #DDDDDD'; 
}

function button_down(eButton){
	eButton.style.backgroundColor 	= '#98B5E2';
	eButton.style.borderColor 		= 'darkblue darkblue darkblue darkblue';
}

function button_up(eButton){
	eButton.style.backgroundColor 	= '#C1D2EE';
	eButton.style.borderColor 		= 'darkblue darkblue darkblue darkblue';
	eButton.style.borderWidth		= '1px';
	eButton.style.cursor 			= 'hand';
}

function darkbutton_over(eButton){
//	eButton.style.backgroundColor 	= '#EFEFEF';
	eButton.style.backgroundColor 	= '#DDDDDD';
	eButton.style.borderColor 		= '#ff9933 #ff9933 #ff9933 #ff9933'; 
	eButton.style.borderWidth		= '1px';
//	eButton.style.cursor 			= 'hand';
	eButton = null;
}
function darkbutton_out(eButton){
	eButton.style.backgroundColor 	= '#EFEFEF';
//	eButton.style.backgroundColor 	= '';
	eButton.style.borderColor 		= '#98B5E2 #98B5E2 #98B5E2 #98B5E2'; 
	eButton.style.borderWidth		= '1px';
}
function darkbutton_down(eButton){
	eButton.style.backgroundColor 	= '#98B5E2';
	eButton.style.borderColor 		= '#f5f5dc #98B5E2 #98B5E2 #f5f5dc';
	eButton.style.borderWidth		= '1px';
}

function cell_change(eCell,eBG,eColor,eCursor){
	eCell.style.backgroundColor 	= eBG;
	eCell.style.color 				= eColor;
//	eCell.style.border				= '1px solid '+eBG;
	if(eCursor=='hand'){
		eCell.style.cursor 			= 'hand';}
	else{
		eCell.style.cursor 			= '';}
	eCell = null;
}


function cell_change2(eCell,eSize,eWeight,eBColor,eColor,eCursor){
	if(eCursor=='hand'){
//		var v = 
		eCell.style.fontSize	=eSize;
		eCell.style.fontWeight	=eWeight;
		eCell.style.border		='1px solid '+eBColor;
		eCell.style.cursor		='hand';
	} else{
		eCell.style.fontSize	=eSize;
		eCell.style.fontWeight	=eWeight;
		eCell.style.border		='';
		eCell.style.cursor		='';
	}
	eCell = null;
}
/*		eCell.style.border			= '1px solid #3a6e8f';
		eCell.style.cursor 			= 'hand'; */
/*		eCell.style.border			= '1px solid transparent';
		eCell.style.cursor 			= ''; */

function findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); return x;
}
function swapImage() {
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function swapImgRestore() {
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() {
 var d=document; if(d.images){ if(!d.p) d.p=new Array();
   var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function fncPlayer(vSource,vBy) {
	if (vBy == "") { vPlayer = "&nbsp;<br />&nbsp;"; }
	else {
		vPlayer = "<object id='WMPEmbed' height='0' width='0' classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'>\n";
		vPlayer = vPlayer + "<param name='autoStart' value='TRUE' />\n";
		vPlayer = vPlayer + "<param name='UIMode' value='none' />\n";
		vPlayer = vPlayer + "<param name='URL' value='" + vSource + "' />\n";
		vPlayer = vPlayer + "</object>\n";
		vPlayer = vPlayer + "<center>";
		vPlayer = vPlayer + "<a href='JavaScript: void(0);' onclick=\"JavaScript: return fncPlayer('','')\"><img border='0' src='/upload/programikoner/iGallery/sm-close.gif' width='19' height='19' alt='Stopp' align='right'></a>";
		vPlayer = vPlayer + vBy;
		vPlayer = vPlayer + "</center>\n";
	}
	document.getElementById("EMBplayer").innerHTML = vPlayer;
	return true;
}

//function ReplaceElements(vTagNames) {
//	var elements = document.getElementsByTagName(vTagNames);
//
//	for (var i=0; i<elements.length; i++) {
//		if (elements[i].src && (elements[i].src.indexOf("tiny_mce.js") != -1 || elements[i].src.indexOf("tiny_mce_dev.js") != -1 || elements[i].src.indexOf("tiny_mce_src.js") != -1 || elements[i].src.indexOf("tiny_mce_gzip") != -1)) {
//			var src = elements[i].src;
//
//			tinyMCE.srcMode = (src.indexOf('_src') != -1 || src.indexOf('_dev') != -1) ? '_src' : '';
//			tinyMCE.gzipMode = src.indexOf('_gzip') != -1;
//			src = src.substring(0, src.lastIndexOf('/'));
//	}
//
//}

/********************************************/
/***    C O U N T D O W N    C L O C K    ***/
/********************************************/
var sep,tw1,tw2,tw3,class1,class2,class3,align1
var da,mo,yr,ho,mi,se;
var countdownwidth='130px';
var countdownheight='20px';
var dd;
var servertime;
// Separator and table width
sep=':';
//tw1='50';
//tw2='1';
//tw3='130';
tw1='';
tw2='1';
tw3='';
class1='bgcol1';
class2='regemp';
class3='reg';
align1='center';

/* KLOKKE FOR NEDTELLING */
function CountDownClock(endtime,servtime){
	var montharray=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
	var dateq=endtime;
	var datetoday=servtime;
	da=dateq.substring(0,2);
	mo=dateq.substring(3,5);
	yr=dateq.substring(6,10);
	ho=dateq.substring(11,13);
	mi=dateq.substring(14,16);
	se='00';
	var ampm=dateq.substring(17,19);
	ampm=ampm.toUpperCase();
	if(ampm=='PM'){
		if(ho!=12){ho=parseInt(ho,10);ho=ho+12;}
	}else{
		if(ampm=='AM'){if(ho==12){ho=0;}
	}
}

var qdatestring=da+','+mo+','+yr+','+ho+','+mi+','+se;
if(document.all){document.write('<span id=""countdownie"" class='+class1+'></span>')}
if(document.getElementById){document.write('<div id=""countdowndiv"" class='+class1+'></div>')}
futurestring=montharray[mo-1]+' '+da+' '+yr+' '+ho+':'+mi+':'+se;
if(datetoday==0){
	today=new Date();
	todayy=today.getYear();
	if(todayy<1000){todayy+=1900;}
	todaym=today.getMonth();
	todayd=today.getDate();
	todayh=today.getHours();
	todaymin=today.getMinutes();
	todaysec=today.getSeconds();
	todaystring=montharray[todaym]+' '+todayd+', '+todayy+' '+todayh+':'+todaymin+':'+todaysec;
}else{
	todayd=datetoday.substring(0,2);
	todaym=datetoday.substring(3,5);
	todayy=datetoday.substring(6,10);
	todayh=datetoday.substring(11,13);
	todaymin=datetoday.substring(14,16);
	todaysec=datetoday.substring(17,19);
	todaystring=montharray[todaym-1]+' '+todayd+' '+todayy+' '+todayh+':'+todaymin+':'+todaysec;
		}
	dd=Date.parse(futurestring)-Date.parse(todaystring);
	window.onload=start_countdown;
}

/* START NEDTELLING*/
function start_countdown(){
	function resized(){
		if(pageWidth!=innerWidth||pageHeight!=innerHeight){location.reload();}
	}
	if(document.layers){
		pageWidth=innerWidth;
		pageHeight=innerHeight;
		window.onresize=resized;
		document.countdownnsmain.visibility='show';
	}
	countdown();
}

/* NEDTELLINGEN */
function countdown(){
	var occasion='Auction End!'
	var message_on_occasion='';
	var opentags='<class='+class2+'>'
	var tabletags='<table class='+class1+' width='+tw3+' HEIGHT=10 Border=0>'
	if(dd>=1000){
		dday=Math.floor(dd/(60*60*1000*24)*1)
		dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
		dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
		dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
		if(dday<=0&&dhour<=0&&dmin<=0&&dsec<1){
		}else{if(document.layers){
			document.countdownnsmain.document.countdownnssub.document.write(tabletags);
			document.countdownnsmain.document.countdownnssub.document.write('<tr class='+class1+'><td width='+tw1+' align='+align1+' class='+class2+'>'+dday+sep)
			document.countdownnsmain.document.countdownnssub.document.write('</td><td width='+tw2+'></td><td width='+tw1+' align='+align1+' class='+class2+'>'+dhour+sep)
			document.countdownnsmain.document.countdownnssub.document.write('</td><td width='+tw2+'></td><td width='+tw1+' align='+align1+' class='+class2+'>'+dmin+sep)
			document.countdownnsmain.document.countdownnssub.document.write('</td><td width='+tw2+'></td><td width='+tw1+' align='+align1+' class='+class2+'>'+dsec)
			document.countdownnsmain.document.countdownnssub.document.write('</td></tr></table>')
			document.countdownnsmain.document.countdownnssub.document.close()
		}else if(document.all){
			HTMLdisp=tabletags;HTMLdisp=HTMLdisp+'<tr class='+class1+'><td width='+tw1+' align='+align1+' class='+class2+'>'+dday+sep
			HTMLdisp=HTMLdisp+'</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class2+'>'+dhour+sep
			HTMLdisp=HTMLdisp+'</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class2+'>'+dmin+sep
			HTMLdisp=HTMLdisp+'</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class2+'>'+dsec
			HTMLdisp=HTMLdisp+'</td></tr></table>';
			countdownie.innerHTML=HTMLdisp
		}else if(document.getElementById){
			content=tabletags;
			content+='<tr class='+class1+'><td width='+tw1+' align='+align1+' class='+class2+'>'+dday+sep;
			content+='</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class2+'>'+dhour+sep;
			content+='</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class2+'>'+dmin+sep;
			content+='</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class2+'>'+dsec;
			content+='</td></tr></table>';
			rng=document.createRange();
			el=document.getElementById('countdowndiv');
			rng.setStartBefore(el);
			htmlFrag=rng.createContextualFragment(content)
			while(el.hasChildNodes())
				el.removeChild(el.lastChild);
				el.appendChild(htmlFrag);
			}
		}
		dd=dd-1000;setTimeout('countdown()',1000);
	}else{if(document.layers){
		document.countdownnsmain.document.countdownnssub.document.write(tabletags)
		document.countdownnsmain.document.countdownnssub.document.write('<tr class='+class1+'><td width='+tw1+' align='+align1+' class='+class3+'>0')
		document.countdownnsmain.document.countdownnssub.document.write('</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class3+'>0')
		document.countdownnsmain.document.countdownnssub.document.write('</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class3+'>0')
		document.countdownnsmain.document.countdownnssub.document.write('</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class3+'>0')
		document.countdownnsmain.document.countdownnssub.document.write('</td></tr></table>')
		document.countdownnsmain.document.countdownnssub.document.close()
	}else if(document.all){
		HTMLdisp=tabletags;
		HTMLdisp=HTMLdisp+'<tr class='+class1+'><td width='+tw1+' align='+align1+' class='+class3+'>0'
		HTMLdisp=HTMLdisp+'</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class3+'>0'
		HTMLdisp=HTMLdisp+'</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class3+'>0'
		HTMLdisp=HTMLdisp+'</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class3+'>0'
		HTMLdisp=HTMLdisp+'</td></tr></table>'
		countdownie.innerHTML=HTMLdisp
	}else if(document.getElementById){content=tabletags;
		content=content+'<tr class='+class1+'><td width='+tw1+' align='+align1+' class='+class3+'>0'
		content=content+'</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class3+'>0'
		content=content+'</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class3+'>0'
		content=content+'</td><td width='+tw2+' class='+class1+'></td><td width='+tw1+' align='+align1+' class='+class3+'>0'
		content=content+'</td></tr></table>'
		rng=document.createRange();
		el=document.getElementById('countdowndiv');
		rng.setStartBefore(el);
		htmlFrag=rng.createContextualFragment(content)
		while(el.hasChildNodes())
			el.removeChild(el.lastChild);
			el.appendChild(htmlFrag);
		}
		return
	}
}