

	function submitonEnter(evt,formular){ 

var charCode = (evt.which) ? evt.which : event.keyCode 
if(charCode == "13"){ 
document.loggain.submit(); 
} 
} 

	function clickQuickSearch(activemode) {

		if (activemode == 'active') {
			document.getElementById("quicksearch").className = 'active';
			if (document.getElementById("quicksearch").value == 'Skriv för att snabbsöka') {
				document.getElementById("quicksearch").value = '';
			}
		} else {
			document.getElementById("quicksearch").className = '';
			if (document.getElementById("quicksearch").value == '') {
				document.getElementById("quicksearch").value = 'Skriv för att snabbsöka';
			}
		}

	}

  
  function onmouseoverbutton(thisbutton,buttonclassname) {

    if (thisbutton.className != buttonclassname + 'submit') {
	  thisbutton.className = buttonclassname + '_hover';
	}
  }

  function onmouseoutbutton(thisbutton,buttonclassname) {

    if (thisbutton.className != buttonclassname + 'submit') {
	  thisbutton.className = buttonclassname;
	}
  }

function goToURL(locationhref) { 
  document.location.href = locationhref;
}


function disableEnterKey(e)
{
     var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox

     if(key == 13)
          return false;
     else
          return true;
}



function submitnewlink() {

  idfortypeid 	= document.getElementById("idfortypeid").value ;
  linktypeid 	= document.getElementById("linktypeid").value ;
  
  titlevalue 	= document.getElementById("title").value ;
  linkvalue 	= document.getElementById("link").value ;

  
  if (document.getElementById("link").value.length > 15) {
  
    //alert('linkvalue' + linkvalue);
  
    document.getElementById("linkthumbnail").className = 'linkthumbnail'; 
    document.getElementById("linkthumbnail").innerHTML = '<div align="center" style="margin-top: 80px;"><img src="/_gfx/ajax-loader.gif" /><br />.. laddar bild...</div>'; 

	document.getElementById("title").value = '';
	document.getElementById("link").value = 'http://';
	
	linkvalue = escape(linkvalue);
	
    sendajax('10','/_commondata/ajax/link_add.asp?Action=insert&idfortypeid=' + idfortypeid + '&linktypeid=' + linktypeid + '&title=' + titlevalue + '&url=' + linkvalue, 'linkthumbnail')

	
	
  } else {
  
    alert('Du måste ange en korrekt länk');
    document.submitlink.link.focus();
  
  }
  
}



function changeRegionLan () {

  // alert('sss');
  var regionlanid = document.getElementById('regionlanid').value;

  sendajax(regionlanid,'/_commondata/ajax/getregioncity.asp?submit=true','regioncityiddiv');

}







	var boxClicked = false;

	function clearIfNotClicked( box )
	{
		if( !boxClicked )
		{
			box.value = '';
			boxClicked = true;
		}
	}

  
function showhide(id){ 
if (document.getElementById){ 
obj = document.getElementById(id); 
if (obj.style.display == "none"){ 
obj.style.display = ""; 
} else { 
obj.style.display = "none"; 
} 
} 
} 

function toggleLayer( whichLayer )
{
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}



function toggle(theId,swapto) { 

check0 = new Image(10, 10);
check0.src = "checkboxa0.gif";
check1 = new Image(10, 10);
check1.src = "checkboxa1.gif";

if(document.getElementById) { 
var cell =  document.getElementById('cell' + theId); 
/*
var checkb =  document.getElementById('check' + theId); 
var ref	= document.getElementById('checkbox' + theId); 
*/
 //if(ref.src == check0.src) ref.src = check1.src;
 //else ref.src = check0.src;

if(swapto == "off") { 
  cell.className = "on"; 
  //checkb.className = "darkershade";
  /*checkb.checked = true;
  ref.src = check1.src;*/
} 
else { 
  cell.className = "off"; 
  //checkb.className = "lightshade";
  /*checkb.checked = false;
  ref.src = check0.src;*/
  } 
 } 
} 



function checkAllFields(ref,outp)
{
var chkAll = document.getElementById('checkall');
var checks = document.getElementsByName('delAnn[]');
var removeButton = document.getElementById('removeChecked');
var boxLength = checks.length;
var allChecked = false;
var totalChecked = 0;


	//alert(ref);
	
	if ( ref == 'all' )
	
	{
		if ( chkAll.checked == true )
		{
			for ( i=0; i < boxLength; i++ )
			{
			checks[i].checked = true;
			toggle(i,'off');
			}
            
		}
		else
		{
			for ( i=0; i < boxLength; i++ )
			{
			checks[i].checked = false;
			toggle(i,'on');
			}
		}
	}
	else
	{
		if ( checks[ref].checked == true ) {
		
		toggle(ref,'off');
		}
		else 
		{
		toggle(ref,'on');
		}
		for ( i=0; i < boxLength; i++ )
		{
			if ( checks[i].checked == true )
			{
			allChecked = true;
			continue;
			}
			else
			{
			allChecked = false;
			break;
			}
		}
		if ( allChecked == true )
		chkAll.checked = true;
		else
		chkAll.checked = false;
	}
	for ( j=0; j < boxLength; j++ )
	{
		if ( checks[j].checked == true )
		totalChecked++;
	}
	removeButton.value = "" + outp + ""+totalChecked+" st markerade";
}


function BoxHover(o,bHover,bKeepBG)
{
  function out(id)
  {
    var o = document.getElementById(id+"_top");
    if (o) o.className = o.className.substr(0,o.className.indexOf(" "));
    o = document.getElementById(id+"_img0");
    if (o) o.style.display="";
    o = document.getElementById(id+"_img1");
    if (o) o.style.display="none";
    o = document.getElementById(id+"");
    if (o) o.style.backgroundPosition="0px 0px";

  }
  if (!window.out) window.out = out;
  if (bHover) {
    if (o.bHover == 2) return;
    o.bHover = bHover;
    if (o.timer) clearTimeout(o.timer);
    var id =o.id;
    o = document.getElementById(id+"_top");
    if(o) o.className += " hover";
    o = document.getElementById(id+"_img0");
    if (o) o.style.display="none";
    o = document.getElementById(id+"_img1");
    if (o) o.style.display="";
    o = document.getElementById(id+"");
    if (o && !bKeepBG) o.style.backgroundPosition="-185px 0px";

  } else if (o.bHover != 2) o.timer = setTimeout("out('"+o.id+"')",10);
}




function log_out()
{
	ht = document.getElementsByTagName("html");
	ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	if (confirm('Är du säker på att du vill logga ut?'))
	{
		return true;
	}
	else
	{
		ht[0].style.filter = "";
		return false;
	}
}



	function initPage() 
		{
		  hideLoading();
		  //setTimeout(doNews,500); 
		}

	function initPageMember() 
		{
		  /*hideLoading();*/
		  /*hideLoading();*/
		  setTimeout(doMemberFrame,500); 
		}
		
	function doNews() 
		{
		  sendajax('10','/_commondata/ajax/getnews.asp?submit=true','pagecontentsnews')
		  setTimeout(doNews,60000); 
		}
		
		
	function sendajaxvote(Grade, GradeURL, UpdateDiv) 
		{
		var votecomment = document.getElementById('votecomment').value;
	
		if (votecomment.length >= 10 && votecomment.length <= 500) 
		  {
		    GradeURL = GradeURL + '&comment=' + votecomment
		    sendajax(Grade,GradeURL,UpdateDiv)
		  } else {
		    alert('Du måste ange en kommentar på minst 10 tecken och max 500 tecken när du lägger detta omdöme');
		  }
		
		}
	

	function doMemberFrame() 
		{

		  sendajax('10','/_commondata/ajax/member.asp?section=memberframe&action=getnewicons','member_container');
		  setTimeout(doMemberFrame,10000); 
		  
		}
		
	function doFriends() 
		{

		  sendajax('10','/_commondata/ajax/member.asp?section=icon&action=getfriends','subnavsearchmember');
		  setTimeout(doFriends,30000); 
		  
		}
		  
		
		
	function hideLoading()
	    {
        	/*showhide('pagecontentsdisplayloading')*/
		}
		
	function quicksearch(quicksearchvalue,quicksearchtype,typeid) 
		{
		
		   if (typeid == -1) {
		     sendajax(quicksearchvalue,'/_commondata/ajax/quicksearch.asp?section=main&action=display','pagecontentssearchdisplay');
		   } else {
		     
  		 if (quicksearchtype == 'id' ) {
		    
			/* BY ID */
			if ((quicksearchvalue.length >= 5) || (quicksearchvalue.length >= 4)) {
			   if (IsNumeric(quicksearchvalue) == true) {
			     document.getElementById("searchbyid" + typeid).className = 'noerrors';
			     sendajax(quicksearchvalue,'/_commondata/ajax/quicksearch.asp?section=bb&action=display&stype=id&picturetypeid=' + typeid,'searchdisplay')
			   } else {
			     document.getElementById("searchbyid" + typeid).className = 'error';
			   }
			} else {
			
			  document.getElementById("searchbyid" + typeid).className = 'error';
			  
			}
		  }
		  else
		  {
		
		     /*  BY NAME */
			 
			 sendajax(quicksearchvalue,'/_commondata/ajax/quicksearch.asp?section=bb&action=display&stype=name&picturetypeid=' + typeid,'searchdisplay')
		
		  }
		   
	    }
	}

		
	function quicksearchmember(memberquicksearchvalue) 
		{
		   sendajax(memberquicksearchvalue,'/_commondata/ajax/quicksearch.asp?section=member&action=display', 'pagecontentssearchmemberdisplay')
		}
	
	function quicksearchobject(objectquicksearchvalue,ToWhat) 
		{
		   sendajax(objectquicksearchvalue,'/_commondata/ajax/quicksearch.asp?section=object&action=display&towhat=' + ToWhat,'pagecontentssearchobjectdisplay')
		}
		
	function quicksearchobjecttocompanylist(objectquicksearchvalue,ToWhat) 
		{
		   sendajax(objectquicksearchvalue,'/_commondata/ajax/quicksearch.asp?section=object&action=displayforcompany&towhat=' + ToWhat,'pagecontentssearchobjecttocompanylistdisplay')
		}
		
	function quicksearchproduct(productquicksearchvalue,ToWhat) 
		{
		   sendajax(productquicksearchvalue,'/_commondata/ajax/quicksearch.asp?section=product&action=display&towhat=' + ToWhat,'pagecontentssearchproductdisplay')
		}
	
	function quicksearchproductthread(ForumThreadID,productquicksearchvalue) 
		{
		   sendajax(productquicksearchvalue,'/_commondata/ajax/quicksearch.asp?section=thread&action=displayproduct&ForumThreadID=' + ForumThreadID,'forumthreadconnection_searchdisplay')
		}
		
	function quicksearchobjectthread(ForumThreadID,objectquicksearchvalue) 
		{
		   sendajax(objectquicksearchvalue,'/_commondata/ajax/quicksearch.asp?section=thread&action=displayobject&ForumThreadID=' + ForumThreadID,'forumthreadconnection_searchdisplay')
		}
		
	function quicksearch_close() 
		{
			document.getElementById('pagecontentssearchdisplay').innerHTML = '';
		   //sendajax('10','/_commondata/ajax/blank.asp?submit=true','pagecontentssearchdisplay')
		}

	function quicksearchsmall_close(what) 
		{
			document.getElementById('pagecontentssearch' + what + 'display').innerHTML = '';
		   //sendajax('10','/_commondata/ajax/blank.asp?submit=true','pagecontentssearch' + what + 'display')
		}
		
	function quicksearchlarge_close() 
		{
			document.getElementById('forumthreadconnection_searchdisplay').innerHTML = '';
		   //sendajax('10','/_commondata/ajax/blank.asp?submit=true','forumthreadconnection_searchdisplay')
		}
		
		
		
		
	function comboBoxAction(boxname,boxvalue) 
		{
		  sendajaxasync('10','/_commondata/ajax/combobox.asp?submit=true&boxvalue=' + boxvalue + '&boxname=' + boxname,'combobox' + boxname)
		  xstooltip_hide('dropdownlist_' + boxname);
		  top.location.href  = top.location.href;
		  
		}
		
	function displayInfobox(boxname) 
		{
		  sendajax('10','/_commondata/ajax/display_infotext.asp?submit=true&boxname=' + boxname,'informationbox_' + boxname);
		  xstooltip_show('informationbox_' + boxname, 'informationimg_' + boxname, 0, 18);
		}
		
	function displaynonAjaxInfobox(boxname) 
		{
  	  		xstooltip_show('informationbox_' + boxname, 'informationimg_' + boxname, 0, 18);
		}
		
	function reportPrice(ProductID) 
		{
		  var CompanyID = document.getElementById('CompanyID').value;
		  var Price = document.getElementById('price').value;
		  if (Price.length > 1) {
		    document.getElementById('Submit').disabled = true;
		    sendajax('10','/_commondata/ajax/product?Section=price&Action=report&ProductID=' + ProductID + '&CompanyID=' + CompanyID + '&Price=' + Price,'reportprice');
		    document.getElementById('Submit').disabled = false;
		  } else {
			document.getElementById('price').className = 'error';
		    document.getElementById('reportprice').innerHTML = "<span class=error>Du måste ange ett giltigt värde</span>";
		  }
		  
		}
		

 var selects;
    var inputs;
    var radios = new Array();
    var checkboxes = new Array();
    var hovers = new Array();
    var buttons = new Array();
    var selectText = "please select";

	function DisplayPopupWindow(ThrUrl, TheWindowName, TheX, TheY) {
		NewWindow = window.open('' + ThrUrl + '','' + TheWindowName + '','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=' + TheX + ',height=' + TheY + '');
		NewWindow.focus();
	}
	
	function displayrules() {
		NewWindow = window.open('/rules.asp','displayrules','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=950,height=600');
		NewWindow.focus();
	}
	
	function report(ReportSection,ReportItemID) {
		NewWindow = window.open('/displayreport.asp?ReportedSectionID=' + ReportSection + '&ReportedItemID=' + ReportItemID + '','displayrules','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width=400,height=400');
		NewWindow.focus();
	}
	
	
var state = 'block'; 

function showhide(layer_ref) { 

if (state == 'block') { 
state = 'none'; 
} 
else { 
state = 'block'; 
} 
if (document.all) { //IS IE 4 or 5 (or 6 beta) 
eval( "document.all." + layer_ref + ".style.display = state"); 
} 
if (document.layers) { //IS NETSCAPE 4 or below 
document.layers[layer_ref].display = state; 
} 
if (document.getElementById &&!document.all) { 
hza = document.getElementById(layer_ref); 
hza.style.display = state; 
} 
} 
	
	
function validateForm() {
	
	document.object_family_add.submit();
	
}

	function createpicturewindow(PictureID, TypeID) {
	    var TheX = 940;
		var TheY = 700;
		NewWindow = window.open('/displaypicture.asp?PictureID=' + PictureID + '&TypeID=' + TypeID + '','Picture' + PictureID + '','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=' + TheX + ',height=' + TheY + '');
		NewWindow.focus();
	}

	function createmoviewindow(MovieID, TypeID) {
	    var TheX = 940;
		var TheY = 700;
		NewWindow = window.open('/displaymovie.asp?MovieID=' + MovieID + '&TypeID=' + TypeID + '','Movie' + MovieID + '','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=' + TheX + ',height=' + TheY + '');
		NewWindow.focus();
	}

	function displayicon(Hrefp) {
	    var TheX = 500;
		var TheY = 400;
		NewWindow = window.open(Hrefp,'icon','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width=' + TheX + ',height=' + TheY + '');
		NewWindow.focus();
	}

	
function hoverEffects() {
	//get all elements (text inputs, passwords inputs, textareas)
	var elements = document.getElementsByTagName('input');
	var j = 0;
	for (var i4 = 0; i4 < elements.length; i4++) {
		if((elements[i4].type=='text')||(elements[i4].type=='password')) {
			hovers[j] = elements[i4];
			++j;
		}
	}
	elements = document.getElementsByTagName('textarea');
	for (var i4 = 0; i4 < elements.length; i4++) {
		hovers[j] = elements[i4];
		++j;
	}
	
	//add focus effects
	for (var i4 = 0; i4 < hovers.length; i4++) {
		hovers[i4].onfocus = function() {this.className += "Hovered";}
		hovers[i4].onblur = function() {this.className = this.className.replace(/Hovered/g, "");}
	}
}

function buttonHovers() {
	//get all buttons
	var elements = document.getElementsByTagName('input');
	var j = 0;
	for (var i5 = 0; i5 < elements.length; i5++) {
		if(elements[i5].type=='submit') {
			buttons[j] = elements[i5];
			++j;
		}
	}
	
	//add hover effects
	for (var i5 = 0; i5 < buttons.length; i5++) {
		buttons[i5].onmouseover = function() {this.className += "Hovered";}
		buttons[i5].onmouseout = function() {this.className = this.className.replace(/Hovered/g, "");}
	}
}

function init() {
	
	//check if styles are enabled and only then start replacing elements

	hoverEffects();
	buttonHovers();
}

	
	window.onload = init;
	
	
		function resetsubmitvalue()
		{
		  document.object_add.submittrue.value = '0';
		  //showhideact('pageloading','show');
		  document.object_add.submit();
		}
		
		
/* ====== BEGRÄNSA TEXTLÄNGDER ====== */

function checkInputAll (e, who, where, type, max) {
	var key = e.keyCode;
	updateLength(who, where, max);
	return (who.value.length < max || isNavKey(key) || isModifierKey(e) ); 
}

function updateLength(who, where, max) {
	number = document.getElementById(where + "CharLenNumber");
	scale = document.getElementById(where + "CharLenScale");
	scaleDiv = document.getElementById(where + "CharLen");
	number.innerHTML = who.value.length + " av " + max + ""; 
	if (who.value.length >= max) {
		number.className = "error";
		scale.style.width = "100%";
		if (max > 200) scaleDiv.style.display = "block";
	} else {
		percent = parseInt(who.value.length / max * 100);
		if (percent > 100) percent = 100;
		if (percent > 80) {
			if (max > 200) scaleDiv.style.display = "block";
		} else {
			if (max > 200) scaleDiv.style.display = "none";
		}
		scale.style.width = percent + "%";
		number.className = "";
	}
}



function submitlink() {


  titlevalue = document.getElementById("title").value ;
  linkvalue = document.getElementById("link").value ;
  
  alert('aaa');
  
  if (document.getElementById("link").value.length > 17) {
  
    //alert('linkvalue' + linkvalue);
  
    document.getElementById("linkthumbnail").className = 'linkthumbnail'; 
    document.getElementById("linkthumbnail").innerHTML = '<div align="center" style="margin-top: 80px;"><img src="/_gfx/ajax-loader.gif" /><br />.. laddar bild...</div>'; 

	document.getElementById("title").value = '';
	document.getElementById("link").value = 'http://';
	
    sendajax('10','/_commondata/ajax/link_add.asp?Action=insert&title=' + titlevalue + '&url=' + linkvalue, 'linkthumbnail')

	
	
  } else {
  
    alert('Du måste ange en korrekt länk');
    document.submitlink.link.focus();
  
  }
  
}






// ***********************
// hacks and workarounds *
// ***********************

// initialize hacks whenever the page loads
window.onload = initializeHacks;

// setup an event handler to hide popups for generic clicks on the document
document.onclick = hideCurrentPopup;

function initializeHacks() {
    // this ugly little hack resizes a blank div to make sure you can click
    // anywhere in the window for Mac MSIE 5
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	window.onresize = explorerMacResizeFix;
    }
    resizeBlankDiv();
    // this next function creates a placeholder object for older browsers
    createFakeEventObj();
}

function createFakeEventObj() {
    // create a fake event object for older browsers to avoid errors in function call
    // when we need to pass the event object to functions
    if (!window.event) {
	window.event = false;
    }
} // createFakeEventObj

function resizeBlankDiv() {
    // resize blank placeholder div so IE 5 on mac will get all clicks in window
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	getStyleObject('blankDiv').width = document.body.clientWidth - 20;
	getStyleObject('blankDiv').height = document.body.clientHeight - 20;
    }
}

function explorerMacResizeFix () {
    location.reload(false);
}




function hideCurrentPopup() {
    // note: we've stored the currently-visible popup on the global object window.currentlyVisiblePopup
    if(window.currentlyVisiblePopup) {
	changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
	window.currentlyVisiblePopup = false;
    }
} // hideCurrentPopup






function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

  
  function switchfreshsalt(freshsaltvar) {
    
    document.getElementById("freshsalt").value = freshsaltvar ;
  
    document.bbeditor.submit();
  
  }
  

  function clickOption(newselectedvalue,area){
  
    var selectedvalue;
  
    selectedvalue = document.getElementById("aquarium" + area + "idcontainer").value ;
    
	//alert(selectedvalue);
	
	//alert(newselectedvalue);
	
	// SET INACTIVE CLASS TO ACTIVE BOX
	document.getElementById("aquarium" + area + "idbox" + selectedvalue).className = 'inactiveclass';
	//document.getElementById("aquariumsectionid" + selectedvalue).checked  = false;
	
	// SET SELECTED CLASS TO THE NEW BOX  
	document.getElementById("aquarium" + area + "idbox" + newselectedvalue).className = 'selectedclass';
	document.getElementById("aquarium" + area + "id" + newselectedvalue).checked  = true;
	  
	// SET NEW VALUE TO CONTAINER
	document.getElementById("aquarium" + area + "idcontainer").value = newselectedvalue;
	//document.getElementById("aquarium" + area + "id").value = newselectedvalue;


	
  }
  
  function clickOnmouseover(newselectedvalue,area){
    
	//alert(newselectedvalue);
	
    if(document.getElementById("aquarium" + area + "idbox" + newselectedvalue).className != 'selectedclass') {
	  
	  document.getElementById("aquarium" + area + "idbox" + newselectedvalue).className = 'activeclass';
	
	}
  }
  
  function clickOnmouseout(newselectedvalue,area){
  
    if(document.getElementById("aquarium" + area + "idbox" + newselectedvalue).className != 'selectedclass') {
	  
	  document.getElementById("aquarium" + area + "idbox" + newselectedvalue).className = 'inactiveclass';
	
	}
  }
  
  function calculateVolume(){
  
  if(IsNumeric(document.getElementById("AquariumLength").value) == true && IsNumeric(document.getElementById("AquariumHeight").value) == true && IsNumeric(document.getElementById("AquariumDepth").value) == true) {
  
    if(document.getElementById("AquariumLength").value.length > 0 && document.getElementById("AquariumHeight").value.length > 0 && document.getElementById("AquariumDepth").value.length > 0) {
	  
	  document.getElementById("AquariumVolume").value = Math.round((document.getElementById("AquariumLength").value / 10) * (document.getElementById("AquariumHeight").value /10) * (document.getElementById("AquariumDepth").value /10)) ;
	
	}
   }
  }
  
function  displaypreloadpic(thissvalue,pageuploaddiv) {

  var nrFiles = document.getElementById("newuploadscounter").value;

  var sendstring = '/_commondata/ajax/member.asp?Section=memberaquarium&Action=quicksearchproduct?submit=true'
  sendajax(thissvalue,sendstring,pageuploaddiv);
  
  if (thissvalue > 0) {
    document.getElementById("newuploadscounter").value = nrFiles + 1;
  } else {
    document.getElementById("newuploadscounter").value = 0
  }

}
 
function  checksubmit() {

  var nrFiles = document.getElementById("newuploadscounter").value;

  if (nrFiles > 0) {
 	if  (confirm('Du har filer som inte laddats upp. Är du säker du vill posta formuläret ändå?'))
	{
		document.bbeditor.submit();
	}
	else
	{
		void(0);
	}
  } else {
    document.bbeditor.submit();
  }

}
 
  
function clickSetting(area){

    if(document.getElementById(area).checked == true) {

	  document.getElementById(area + "ValueContainer").style.display = 'inline';
	  
	} else {

	  document.getElementById(area + "ValueContainer").style.display = 'none';

	}

  }
  
  function submitAquarium() {
  
  document.getElementById("checker").value = '1';

  document.bbeditor.submit();
  
  }
  
  
  
			  function  quickanswer(extendedans) {
			  
				  if (extendedans == 'extended') {
				    document.bbeditor.extended.value = 'extended';
					document.bbeditor.submit();
				  }
				  else {
				    if ((document.bbeditor.inlagg.value.length > 10) && (document.bbeditor.inlagg.value != 'Klicka här om du vill snabbsvara på inlägget')) {
					
				      document.bbeditor.extended.value = '';
					  document.bbeditor.submit();
					  }
				    else {
				      alert('Du måste ange minst 10 tecken');
				      document.bbeditor.inlagg.focus();
				   }
			      }

				  }
	
function  addobjectToAquarium() {

  var ObjectID;
  var MemberAquariumID;
  var MemberAquariumArtStatusID;
  var Number;

  ObjectID 					= document.getElementById("ObjectID").value;
  MemberAquariumID 			= document.getElementById("MemberAquariumID").value;
  Number 					= document.getElementById("number").value;
  MemberAquariumArtStatusID = document.getElementById("MemberAquariumArtStatusID").value;
  TextDescriptionAdd		= document.getElementById("TextDescriptionAdd").value;
 
  var sendstring = '/_commondata/ajax/member.asp?section=memberaquarium&action=objectadd&TextName=' + TextDescriptionAdd + '&ObjectID=' + ObjectID + '&MemberAquariumID=' + MemberAquariumID + '&MemberAquariumArtStatusID=' + MemberAquariumArtStatusID + '&Number=' + Number + '';
	
  sendajax('10',sendstring,'addobjecttoaquarium');

}


function  removeobjectToAquarium() {


  var ObjectID;
  var MemberAquariumID;
  var Number;
  var MemberAquariumArtStatusID;
  ObjectID 					= document.getElementById("ObjectID").value;
  MemberAquariumID 			= document.getElementById("MemberAquariumID").value;
  Number 					= document.getElementById("numberrev").value;
  MemberAquariumArtStatusID = document.objectnumberremove.MemberAquariumArtStatusID.value;
  TextDescriptionRemove		= document.getElementById("TextDescriptionRemove").value;
  
  var sendstring = '/_commondata/ajax/member.asp?section=memberaquarium&action=objectremove&TextName=' + TextDescriptionRemove + '&ObjectID=' + ObjectID + '&MemberAquariumID=' + MemberAquariumID + '&MemberAquariumArtStatusID=' + MemberAquariumArtStatusID + '&Number=' + Number + ''
    
  sendajax('10',sendstring,'removeobjecttoaquarium');
  

}


function  selectobjectToAquarium(ObjectID,MemberAquariumID) {

  var sendstring = '/_commondata/ajax/member.asp?section=memberaquarium&action=quicksearchobject&MemberAquariumID=' + MemberAquariumID
  sendajax(ObjectID,sendstring,'addobjecttoaquarium');

}




function  addobjectToCompanyList(ObjectID,CompanyListID) {

  var sendstring = '/_commondata/ajax/company.asp?section=list&action=add&ID=' + CompanyListID + '&ObjectID=' + ObjectID;
  document.getElementById("quicksearchartaddcontainer").innerHTML = '<div class="messagesuccessful">Arten lades till i listan</div>';
  sendajax(ObjectID,sendstring,'displaylistitemlistcontainer');

}

function  selectproductToAquarium(ProductID,MemberAquariumID) {

  var sendstring = '/_commondata/ajax/member.asp?section=memberaquarium&Action=quicksearchproduct&MemberAquariumID=' + MemberAquariumID
    
  sendajax(ProductID,sendstring,'addproducttoaquarium');
  

}


	
function  addproductToAquarium() {

  var ProductID;
  var MemberAquariumID;
  var MemberAquariumProductStatusID;
  var Number;


  ProductID						= document.getElementById("ProductID").value;
  MemberAquariumID 				= document.getElementById("MemberAquariumID").value;

  MemberAquariumProductStatusID = document.getElementById("MemberAquariumProductStatusID").value;
  Number 						= document.getElementById("number").value;


  
  MemberPrice					= document.getElementById("MemberPrice").value;
  TextDescriptionAdd			= document.getElementById("TextDescriptionAdd").value;



  var sendstring = '/_commondata/ajax/member.asp?section=memberaquarium&action=productadd&MemberPrice=' + MemberPrice + '&TextName=' + TextDescriptionAdd + '&ProductID=' + ProductID + '&MemberAquariumID=' + MemberAquariumID + '&MemberAquariumProductStatusID=' + MemberAquariumProductStatusID + '&Number=' + Number + '';


	
  sendajax('10',sendstring,'addproducttoaquarium');
  
  //sendajax('10','/_commondata/ajax/memberaquarium_productadd.asp?submit=true&ProductID=' + ProductID + '&MemberAquariumID=' + MemberAquariumID + '&Number=' + Number + '','addproducttoaquarium');
  

}
	
function  removeproductToAquarium() {


  var ProductID;
  var MemberAquariumID;
  var MemberAquariumProductStatusID;
  var Number;
  
  ProductID						= document.getElementById("ProductID").value;
 
  MemberAquariumID 				= document.getElementById("MemberAquariumID").value;
  MemberAquariumProductStatusID = document.getElementById("MemberAquariumProductStatusID").value;

  Number 					= document.getElementById("numberrev").value;
  TextDescriptionRemove		= document.getElementById("TextDescriptionRemove").value;
  
  var sendstring = '/_commondata/ajax/member.asp?section=memberaquarium&action=productremove&TextName=' + TextDescriptionRemove + '&ProductID=' + ProductID + '&MemberAquariumID=' + MemberAquariumID + '&MemberAquariumProductStatusID=' + MemberAquariumProductStatusID + '&Number=' + Number + ''
    
  sendajax('10',sendstring,'removeproducttoaquarium');
  

}
	
	
function displayaddobjectToAquarium() {
	
  document.getElementById('addobjecttoaquarium').style.display = 'block';
  document.getElementById('addobjecttoaquariumbutton').style.display = 'none';
	
}

function displayaddproductToAquarium() {
	
  document.getElementById('addproducttoaquarium').style.display = 'block';
  document.getElementById('addproducttoaquariumbutton').style.display = 'none';
	
}

	
function  changeProductCategory() {

  var ProductCategoryID;
  ProductCategoryID				= document.getElementById("ProductCategoryID").value;

  sendajax('10','/_commondata/ajax/product.asp?Section=product&Action=categorytree&ProductCategoryID=' + ProductCategoryID + '','productcategoryiddiv');
  

}
	
	

function  updateinputfieldtocompanylist(updatevalue,CompanyListID,CompanyListItemID,updatetype) {
  
  
  if (updatevalue != '') {
  	  
	  var sendstring = '/_commondata/ajax/company.asp?section=list&action=uptitem&CompanyListID=' + CompanyListID + '&type=' + updatetype + '&ID=' + CompanyListItemID + '&updvalue=' + updatevalue
	  sendajax('1',sendstring,'CompanyListItemID' + CompanyListItemID);
  }

}
	
	
function  updateinputfieldtocompanyemaillist(updatevalue,CompanyEmailListID,CompanyEmailListItemID,updatetype) {
  
  if (updatevalue != '') {
  	  
	  var sendstring = '/_commondata/ajax/company.asp?section=email&action=uptitem&CompanyEmailListID=' + CompanyEmailListID + '&type=' + updatetype + '&ID=' + CompanyEmailListItemID + '&updvalue=' + updatevalue
	  sendajax('1',sendstring,'CompanyEmailListItemID' + CompanyEmailListItemID);
  }

}
	
	

function  updateinputfieldtoproductproperty(updatevalue,ProductPropertyToCategoryID,updatetype) {
  
  if (updatevalue != '') {
  	  
	  var sendstring = '/_commondata/ajax/product.asp?section=productproperty&action=updproductpropertyvalue&type=' + updatetype + '&ID=' + ProductPropertyToCategoryID + '&updvalue=' + updatevalue
	  sendajax('1',sendstring,'ProductPropertyToCategoryID' + ProductPropertyToCategoryID);

  }

}
	

function  addproductproperty(ProductPropertyToCategoryID) {
  
  var maxvalue = document.getElementById('maxvalue').value;
  var mainproperty = document.getElementById('mainproperty').value;
  var sortby = document.getElementById('sortby').value;
  var ProductPropertyID = document.getElementById('ProductPropertyID').value;
  
  if (ProductPropertyID != '') {
  	  
	  var sendstring = '/_commondata/ajax/product.asp?section=productproperty&action=addproductpropertyvalue&ProductPropertyID=' + ProductPropertyID + '&maxvalue=' + maxvalue + '&ID=' + ProductPropertyToCategoryID + '&mainproperty=' + mainproperty + '&sortby=' + sortby
	  sendajax('1',sendstring,'updatepropertyvalue');

  }
}
	

function  addproductpropertytype() {
  
  var ProductPropertyTypeID = document.getElementById('ProductPropertyTypeID').value;
  var textname = document.getElementById('textname').value;
  var UnitText = document.getElementById('UnitText').value;
  var InformationText = document.getElementById('InformationText').value;
  var AdminText = document.getElementById('AdminText').value;
  
  if (ProductPropertyTypeID != '') {
  	  
	  var sendstring = '/_commondata/ajax/product.asp?section=productproperty&action=insertpropertyvalue&ProductPropertyTypeID=' + ProductPropertyTypeID + '&textname=' + textname + '&UnitText=' + UnitText + '&InformationText=' + InformationText + '&AdminText=' + AdminText
	  sendajax('1',sendstring,'insertpropertyvalue');

  }
}
	
	
	
	
	
function  submitQuizAnswer(quizid,questionid) {

  var Answer;
  Answer				= document.getElementById("questionbox" + questionid + "answer").value;

 // alert(Answer);
  
  if (document.getElementById("questionbox" + questionid + "answer").value.length > 0) {
  
 	if (confirm('Är du säker på att du har bestämt dig för ditt svar?'))
	{
		sendajax('10','/_commondata/ajax/quiz_answer.asp?submit=true&Answer=' + Answer + '&quizid=' + quizid + '&questionid=' + questionid + '','questionbox' + questionid + 'answerbox');
	}
	else
	{
		return false;
	}
 
  } else {
  
  }
}

function  displayForumThreadConnection(ForumThreadID,displayForumThreadConnectionName) {


  sendajax('10','/_commondata/ajax/forum.asp?section=connection&ForumThreadID=' + ForumThreadID + '&type=' + displayForumThreadConnectionName,'forumthreadconnectiondisplay');
  

}




function  addproducttoforumthread(ForumThreadID, ProductID) {

  var sendstring = '/_commondata/ajax/quicksearch.asp?section=thread&action=addproduct&ForumThreadID=' + ForumThreadID + '&ProductID=' + ProductID;

  sendajax('10',sendstring,'quicksearchunit' + ProductID + 'display');
  

}
	

function  addobjecttoforumthread(ForumThreadID, ObjectID) {

  var sendstring = '/_commondata/ajax/quicksearch.asp?section=thread&action=addobject&ForumThreadID=' + ForumThreadID + '&ObjectID=' + ObjectID;

  sendajax('10',sendstring,'quicksearchunit' + ObjectID + 'display');
  

}




function  delmemberblog(MemberBlogID) {

  var sendstring = '/_commondata/ajax/member.asp?section=blog&action=removesubmit=true&MemberBlogID=' + MemberBlogID;

  if (confirm('Vill du radera denna blogg?'))
  { 
    sendajax('10',sendstring,'delblogcontainer');
  }
}
	



function  delproducttoforumthread(ForumThreadID, ProductID) {

  var sendstring = '/_commondata/ajax/quicksearch.asp?section=thread&action=removeproduct&ForumThreadID=' + ForumThreadID + '&ProductID=' + ProductID;

  sendajax('10',sendstring,'quicksearchunit' + ProductID + 'display');
  

}
	

function  removeobjecttoforumthread(ForumThreadID, ObjectID) {

  var sendstring = '/_commondata/ajax/quicksearch.asp?section=thread&action=removeobject&ForumThreadID=' + ForumThreadID + '&ObjectID=' + ObjectID;

  sendajax('10',sendstring,'quicksearchunit' + ObjectID + 'display');
  

}


function  companylistremove(CompanyListID, CompanyListItemID) {

  var sendstring = '/_commondata/ajax/company.asp?section=list&action=removeitem&CompanyListID=' + CompanyListID + '&ID=' + CompanyListItemID;
  sendajax('10',sendstring,'CompanyListItemID' + CompanyListItemID);
	document.getElementById('tr' + CompanyListItemID).style.display = 'none';

}




function  companyemaillistremove(CompanyEmailListID, CompanyEmailListItemID) {

  var sendstring = '/_commondata/ajax/company.asp?section=email&action=removeitem&CompanyEmailListID=' + CompanyEmailListID + '&ID=' + CompanyEmailListItemID;
  
  sendajax('10',sendstring,'CompanyEmailListItemID' + CompanyEmailListItemID);
  document.getElementById('tr' + CompanyEmailListItemID).style.display = 'none';

}


function  newrules(acceptrulesswitch) {

  var sendstring = '/_commondata/ajax/member.asp?section=rules&action=' + acceptrulesswitch;

  sendajax('10',sendstring,'newlexicontext');
  
  document.getElementById('newlexicontext').style.display = 'none';
  document.getElementById('newlexicon').style.display = 'none';
  document.getElementById('newlexicontextt').style.display = 'none';
  document.getElementById('newlexiconborder').style.display = 'none';

  if (acceptrulesswitch != '1') {
  		document.location.href = 'http://www.akvarielexikonet.se'
  }
  
}


function getY( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetTop;
oElement = oElement.offsetParent;
}
return iReturnValue;
}

function getX( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetLeft;
oElement = oElement.offsetParent;
}
return iReturnValue;
}


function getWidth( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetWidth;
oElement = oElement.offsetParent;
}
return iReturnValue;
}

function getHeight( oElement )
{
var iReturnValue = 0;
while( oElement != null ) {
iReturnValue += oElement.offsetHeight;
oElement = oElement.offsetParent;
}
return iReturnValue;
}


	var cancelshow = '';

	var offset_x = 10;
	var offset_y = 30;

	function display_ajaxtooltip(activeObject,typeofObject,idofObject) {
		
		if (cancelshow =='') {
			//document.getElementById('ajaxtooltipcontainer').style.opacity = 0
			fadeindiv('ajaxtooltipcontainer');
			
			//document.getElementById("ajaxtooltipcontainer").style.display = 'block';
			document.getElementById("ajaxtooltipcontainer").style.top = getY(activeObject) + offset_y + 'px';
			document.getElementById("ajaxtooltipcontainer").style.left = getX(activeObject) + offset_x + 'px';
			sendajax('1','/_commondata/ajax/tooltip.asp?section=' + typeofObject + '&action=display&ID=' + idofObject,'ajaxtooltipcontainer')
		}
	}
		
	function show_ajaxtooltip(activeObject,typeofObject,idofObject) {
		theactiveObject = activeObject
		thetypeofObject = typeofObject
		theidofObject = idofObject
		cancelshow = '';
		activeObject.title = '';
		setTimeout("display_ajaxtooltip(theactiveObject,thetypeofObject,theidofObject)",300);
		
	}
	
	function hide_ajaxtooltip() {
		//document.getElementById('ajaxtooltipcontainer').style.opacity = 0
		cancelshow = '1';
		setTimeout("undisplay_ajaxtooltip()",300);
		
	
	}
	
	function undisplay_ajaxtooltip() {
	
		//fadeoutdiv('ajaxtooltipcontainer');
		document.getElementById("ajaxtooltipcontainer").style.display = 'none';
	}
	
var fadeintime=30; // higher is slower
var fadeouttime=10; // higher is slower
var opacchange=10; // higher is faster (between 2-30 will probably work best)

function fadeindiv(id) 
{ 
document.getElementById(id).style.display="none"
fadeinto=setTimeout("divIn(" + 0 + ",'" + id + "')",fadeintime);
} 

function fadeoutdiv(id) 
{ 
fadeoutto=setTimeout("divOut(" + 100 + ",'" + id + "')",fadeouttime);
} 

function divIn(opacity, id) { 
    opacity+=opacchange;

    var os = document.getElementById(id).style; 
    
    os.opacity = (opacity / 101); 
    os.MozOpacity = (opacity / 101); 
    os.KhtmlOpacity = (opacity / 101); 
    os.filter = "alpha(opacity=" + opacity + ")";
    os.display="inline";
    
    clearTimeout(fadeinto);
    if(opacity<100)
    	{
	fadeinto=setTimeout("divIn(" + opacity + ",'" + id + "')",fadeintime);
    	}
}

function divOut(opacity, id) { 
    opacity-=opacchange;

    var os = document.getElementById(id).style; 
    os.opacity = (opacity / 101); 
    os.MozOpacity = (opacity / 101); 
    os.KhtmlOpacity = (opacity / 101); 
    os.filter = "alpha(opacity=" + opacity + ")";
    
    clearTimeout(fadeoutto);
    if(opacity>0)
    	{
		fadeoutto=setTimeout("divOut(" + opacity + ",'" + id + "')",fadeouttime);
    	}
    else
    	{
	os.display="none";
    	}
} 


function fillmyshit() {
	var Idtype = document.getElementById("lvct").innerHTML;
	
	var sendstring = '/_commondata/ajax/member.asp?section=picture&action=voteajax&idfortypeid=' + Idtype;

	document.getElementById("lvct").style.color = '#444';
    sendajax('10',sendstring, 'lvct');
	document.getElementById("lvct").style.color = '#fff';

}



	function updateSettings(settingtype,setvalue) {
		
		sendajax(settingtype,'/_commondata/ajax/filter.asp?submit=true&setvalue=' + setvalue ,'saveframe');
	}

