<!-- 


function prevImage(id, showMultiple) {
    id = id - 1;
    if(id < 0) id = menuImages.length;
    selectedImageId = id;
    showSelectedMenu(id);
	showImage(id, showMultiple);							
}

function nextImage(id, showMultiple) {
    id = id + 1;
    if(id >= menuImages.length) id = 0;
    selectedImageId = id;
    showSelectedMenu(id);
    showImage(id, showMultiple);												        
}

function showImage(id, showMultiple) {    
    var div = document.getElementById('selectedmenu');
	if(div) {
	    var image = menuImages[id];	
	    if(image) {
	        var href = '?aid=' + image.aid
	        if(image.url != '') href = image.url;
	        if(menuImages.length >= 3 && showMultiple == true) {
	            var prevId = id + 1;
	            var nextId = id - 1;
	            if(nextId < 1)  nextId = menuImages.length;
	            if(prevId > menuImages.length) prevId = 0;
	            var prev = menuImages[prevId-1];
	            var next = menuImages[nextId-1];
	            //alert(prevId + '-' + id + '-' + nextId);
	            div.innerHTML = ''//image.alt;
	            div.innerHTML += '<img src="' + prev.src + '" alt="' + prev.alt + '"  />';						            
	            div.innerHTML += '<a href="' + href + '"><img src="' + image.activesrc + '" alt="' + image.alt + '"  /></a>';
	            div.innerHTML += '<img src="' + next.src + '" alt="' + next.alt + '"  />';
	        } else {
	            div.innerHTML = '<a href="' + href + '"><img src="' + image.activesrc + '" alt="' + image.alt + '"  /></a>';
	        }						        	        
	    }
	}	
}

function showSelectedMenu(id) {
    for(var i = 0; i < 30; i++) {
	    var submenu = document.getElementById('altsubmenu' + i);
	    if(submenu) {
	        submenu.className = '';	    		    	    
        }
    }
 
    var menu = document.getElementById('altsubmenu' + id);
    if(menu) menu.className = 'selected';    
}

function prevWebReference(id) {
    id = id - 1;
    if(id < 1) id = webReferences.length;
    showWebReference(id);						
}

function nextWebReference(id) {
    id = id + 1;
    if(id > webReferences.length) id = 1;
    showWebReference(id);												
}					

function showWebReference(id) {
    var ref = webReferences[id-1];	
	if(ref) {
	    var customerE = document.getElementById('rbox_customer');
        var deliverableE = document.getElementById('rbox_deliverable');
        var benefitE = document.getElementById('rbox_benefit');
        var savingsE = document.getElementById('rbox_savings');
        var descriptionE = document.getElementById('rbox_description');
        var imagesrcE = document.getElementById('rbox_image');
        var imagesrcbgE = document.getElementById('rbox_webreferencebg');
        
        if(customerE) customerE.innerHTML = ref.customer;
        if(deliverableE) deliverableE.innerHTML = ref.deliverable;
        if(benefitE) benefitE.innerHTML = ref.benefit;
        if(savingsE) savingsE.innerHTML = ref.savings;
        if(descriptionE) descriptionE.innerHTML = ref.description;
        if(imagesrcE) imagesrcE.innerHTML = '<a href="' + ref.url + '"><img src="sites/oxx/im/1by1_trans.gif" alt="" width="185" height="165"/></a>'; 
        if(imagesrcbgE) imagesrcbgE.style.backgroundImage = 'url(' + ref.imagesrc + ')';        
	}
	selectedWebReferenceId = id;
}					

function menuImage(src,activesrc,alt,aid,url,target) {					    
    this.aid = aid;
    this.src = src;
    this.activesrc = activesrc;
    this.alt = alt;
    this.url = url;
    this.target = target;
}

function menuDescription(title,desc) {					    
    this.title = title;
    this.desc = desc;					    
}

function webReference(customer,deliverable,benefit,savings,description,imagesrc, url) {
    this.customer = customer;
    this.deliverable = deliverable;
    this.benefit = benefit;
    this.savings = savings;
    this.description = description;
    this.imagesrc = imagesrc;
    this.url = url;
}

function prevBanner(id) {
    id = id - 1;
    if(id < 1) id = bannerProducts.length;
    showBannerProduct(id);						
}

function nextBanner(id) {
    id = id + 1;
    if(id > bannerProducts.length) id = 1;
    showBannerProduct(id);												
}	

function showBannerProduct(id) {
    var ref = bannerProducts[id-1];	
	if(ref) {
	    var titleE = document.getElementById('banner_title');
        var imagesrcE = document.getElementById('banner_image');
        var descriptionE = document.getElementById('banner_description');        
        if(titleE) titleE.innerHTML = '<a href="' + ref.url + '">' + ref.title + '</a>';
        if(imagesrcE) imagesrcE.innerHTML = '<a href="' + ref.url + '"><img src="' + ref.imagesrc + '" alt="" width="70" height="70"/></a>'; 
        if(descriptionE) descriptionE.innerHTML = '<a href="' + ref.url + '">' + ref.description + '</a>';
	}
	selectedBannerId = id;
}

function bannerProduct(title,imagesrc,description,url) {
    this.title = title;
    this.imagesrc = imagesrc;
    this.description = description;    
    this.url = url;
}

/*
function saveSupportComment(formDivId) {
    var comment = document.getElementById('comment');
    var response = AjaxFactory.AjaxSaveSupportComment(caseId,fixchars(comment.value));
    if(response.value.substring(5,0) != 'Error') {
        comment.value = '';
        hideDiv(formDivId);
        alert(response.value);
    } else {
        var divRtn = document.getElementById('returnmessage');
        divRtn.innerHTML = response.value;       
    }
}

function saveSupportCase(formDivId) {
    //var title = document.getElementById('title');
    var description = document.getElementById('cdescription');
    var url = document.getElementById('url');
    var email = document.getElementById('email');
    //alert(customerId + '-' + description.value + '-' +  url.value + '-' + email.value);
    var response = AjaxFactory.AjaxSaveSupportCase(customerId,fixchars(description.value),url.value,email.value);
    if(response.value.substring(5,0) != 'Error') {
        url.value = '';
        email.value = '';
        description.value = 'http://';    
        hideDiv(formDivId);
        alert(response.value);
    } else {
        var divRtn = document.getElementById('returnmessage');
        divRtn.innerHTML = response.value;    
    }
}*/

function sendForgottenPassword(documentId) {
    //var title = document.getElementById('title');
    var username = document.getElementById('username');
    var divRtn = document.getElementById('returnmessage');
    var response = LogonFactory.AjaxSendForgotPassword(documentId,username.value);
    divRtn.innerHTML = response.value;
    //alert(response.value)
}

/*
function sendCustomerUserRequest(documentId) {
    //var title = document.getElementById('title');
    var customerid = document.getElementById('customerid');
    var email = document.getElementById('email');
    var code = document.getElementById('code');
    var divRtn = document.getElementById('returnmessage');
    var response = LogonFactory.AjaxRetreieveUser(documentId,customerid.value,email.value,code.value);
    divRtn.innerHTML = response.value;
    //alert(response.value)
}

function showSupportCaseForm() {
    var div = document.getElementById('newsupportcase');
    div.style.display = 'block';    
	div.style.visibility = 'visible';		    
	div.style.top = 10 + 'px';
	div.style.left = 10 + 'px';
}

function showSupportCommentForm() {
    var div = document.getElementById('newsupportcomment');
    div.style.display = 'block';    
	div.style.visibility = 'visible';		    
	div.style.top = 10 + 'px';
	div.style.left = 10 + 'px';
}
*/

function hideDiv(id) {
    var div = document.getElementById(id);
    if(div) div.style.display = 'none';
}




function showOverlayForm(formname,topX) {
	var response;
	switch(formname) {
	    case 'moreinfo':	    
	        response = FormFactory.AjaxMoreInfoForm(GetActiveMenuId(),GetActiveDocumentId(), '','','','');
	        break;
	    case 'tips':
	        response = FormFactory.AjaxTipsForm(GetActiveMenuId(),GetActiveDocumentId(), '','','');
	        break;    
	    case 'registernewsletter':
	        response = FormFactory.AjaxRegisterNewsletterForm(GetActiveMenuId(),GetActiveDocumentId(), '','','');
	        break;    
	    case 'questions':
	        response = FormFactory.AjaxQuestionsForm(GetActiveMenuId(),GetActiveDocumentId(), '','','');
	        break;    
	    default:
	        alert('form type not defined');
	        break;
	}
	
	var overlay = document.getElementById('overlay');
	overlay.className = 'overlay-on';
	
	var popup = document.getElementById('overlay-content');
	popup.className = 'overlay-content-on';
	popup.style.left = (windowWidth()/2 - 150) + 'px';
	if(topX == '') topX = 500;
	popup.style.top = (topX - 340) + 'px';
	popup.innerHTML = response.value;		
}

function closeOverlay() {		
	var overlay = document.getElementById('overlay');
	var popup = document.getElementById('overlay-content');

	if(overlay) overlay.className = 'overlay-off';	
	if(popup) popup.className = 'overlay-content-off';	
}

function sendMoreInfoRequest() {
    var name = document.getElementById('name');
    var email = document.getElementById('email');
    var comment = document.getElementById('comment');
    var contactType = document.getElementById('contacttype');
    var response = FormFactory.AjaxSendMoreInfo(GetActiveMenuId(),GetActiveDocumentId(),name.value,email.value,comment.value,contactType.options[contactType.selectedIndex].value);
    var popup = document.getElementById('overlay-content');
	popup.innerHTML = response.value;    
}

function sendTipsRequest() {
    var name = document.getElementById('name');
    var email = document.getElementById('email');
    var comment = document.getElementById('comment');    
    var response = FormFactory.AjaxSendTips(GetActiveMenuId(),GetActiveDocumentId(),name.value,email.value,comment.value);
    var popup = document.getElementById('overlay-content');
	popup.innerHTML = response.value;    
}

function sendRegisterNewsletterRequest() {
    var name = document.getElementById('name');
    var email = document.getElementById('email');
    var comment = document.getElementById('comment');
    var response = FormFactory.AjaxSendRegisterNewsletter(GetActiveMenuId(),GetActiveDocumentId(),name.value,email.value,comment.value);
    var popup = document.getElementById('overlay-content');
	popup.innerHTML = response.value;    
}

function sendQuestionsRequest() {
    var name = document.getElementById('name');
    var email = document.getElementById('email');
    var comment = document.getElementById('comment');
    var response = FormFactory.AjaxSendQuestions(GetActiveMenuId(),GetActiveDocumentId(),name.value,email.value,comment.value);
    var popup = document.getElementById('overlay-content');
	popup.innerHTML = response.value;    
}

function addToFavorites() { 
   if (document.all) { 
        window.external.AddFavorite(location.href, document.title);
    } 
}      

function printPage(did) {
    window.location = 'print.aspx?did=' + did;
    return false;
}

/*function rssPage(aid) {
    window.location = 'rss2.aspx?aid=' + aid;
    return false;
}*/

function fixchars(val) {
	return val.replace(/['_,%`"~#]/g, "");			
}

function screenWidth() {
	var screenW = 840;
	if (parseInt(navigator.appVersion) > 3) {
		screenW = screen.width;	
	}
	else if (navigator.appName == "Netscape" && parseInt(navigator.appVersion)==3 && navigator.javaEnabled()) {
		var jToolkit = java.awt.Toolkit.getDefaultToolkit();
		var jScreenSize = jToolkit.getScreenSize();
		screenW = jScreenSize.width;	
	}
	return screenW;
}

function windowWidth() {
    var winW = 840, winH = 460;

    if (parseInt(navigator.appVersion)>3) {
     if (navigator.appName=="Netscape") {
      winW = window.innerWidth;
      winH = window.innerHeight;
     }
     if (navigator.appName.indexOf("Microsoft")!=-1) {
      winW = document.body.offsetWidth;
      winH = document.body.offsetHeight;
     }
    }
    return winW;
}


function makePopUpWindow(windowName)
{
	var width = "660";
	var height = "740";
	var left="100";
	var top="100";
	var printReportwindow = '';
	var bScroll = "yes";
	var bMenu = "yes";
	var bResize = "yes";
	printReportwindow = open("",windowName,"width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + ',scrollbars=' + bScroll + ',location=' + bMenu + ',directories=' + bMenu + ',status=' + bMenu + ',menubar=' + bMenu + ',toolbar=' + bMenu + ',resizable=' + bResize);
	return printReportwindow;
}


function printPage() {
	var printDiv = document.getElementById('printcontent');
	if(printDiv) {
	    //alert(objReport.innerHTML);
	    //return false;
	    printReportwindow = makePopUpWindow("PrintWindow");
	    printReportwindow.document.open();
	    printReportwindow.document.writeln("<html>");
	    //printReportwindow.document.writeln('<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>');
	    printReportwindow.document.writeln("<title>Print Window</title>");
	    printReportwindow.document.writeln('<link href="http://www.oxx.no/layout.css" type="text/css" rel="stylesheet">');
	    printReportwindow.document.writeln('<link href="http://www.oxx.no/typography.css" type="text/css" rel="stylesheet">');
	    printReportwindow.document.writeln('<link href="http://www.oxx.no/print.css" type="text/css" rel="stylesheet">');
	    printReportwindow.document.writeln('<body  onload="window.print();" class="print">');
	    printReportwindow.document.writeln('<div style="width:650px;">');
	    printReportwindow.document.writeln('<img style="margin-bottom:30px;" src="http://www.oxx.no/sites/oxx/im/logo_print.gif" alt="OXX.no" width="71" height="71" />');
	    printReportwindow.document.write(printDiv.innerHTML);
	    printReportwindow.document.writeln('</div>');
	    printReportwindow.document.write("</body></html>");
	    printReportwindow.document.close(); 
	    if (window.focus) {printReportwindow.focus()}	
	    return false;
	}
}	

function renderActivityCalendar(aid,events,selectedDate, post) {
    var div = document.getElementById('activitycalendar');
    if(div) {
        var response = CalendarFactory.AjaxCalendar(aid,events,selectedDate, post);
        div.innerHTML = response.value;
    }  
}


function sendFlashMail(guid,message) {
    alert(message);
}


// -->

