

function eFixImg(obj)
{
	if (300<obj.width)
		obj.width = 300;
}


function wOpenShop3Mobileinfo(url)
{
	window.open(url, '_blank', 'menubar=0, status=0, scrollbars=1, resizable=0, width=800, height=600');
}

function wOpenForumHeadlineReaderList(n)
{
	window.open('wo_forum_headline_reader.aspx?nHeadlineID=' + n, 'dn_wo_readerlist', 'menubar=0, status=0, scrollbars=1, resizable=0, width=400, height=500');
}

function wOpenGalleryFotoReaderList(n)
{
	window.open('wo_gallery_foto_reader.aspx?nFotoID=' + n, 'dn_wo_readerlist', 'menubar=0, status=0, scrollbars=1, resizable=0, width=400, height=500');
}

function wOpenDiaryReaderList(n)
{
	window.open('wo_diary_reader.aspx?nDiaryID=' + n, 'dn_wo_readerlist', 'menubar=0, status=0, scrollbars=1, resizable=0, width=400, height=500');
}

function wOpenMejlFolderAdd()
{
	window.open('wo_mejl_folderadd.aspx?', 'dn_wo_mejlfolder', 'menubar=0, status=0, scroll=0, resizable=0, width=400, height=160');
}
function wOpenMejlFolderChange(folderid)
{
	window.open('wo_mejl_folderchange.aspx?nFolderID='+folderid+'&', 'dn_wo_mejlfolder', 'menubar=0, status=0, scroll=0, resizable=0, width=400, height=160');
}

function wOpenGbClear()
{
	window.open('wo_gb_clear.aspx?', 'dn_wo_gb', 'menubar=0, status=0, scroll=0, resizable=0, width=250, height=200');
}

function wOpenMejlChange(mejlid)
{
	if (mejlid==null)
		mejlid = 0;
	window.open('wo_mejl_change.aspx?nMejlID='+mejlid+'&', 'dn_wo_mejl', 'menubar=0, status=0, scroll=0, resizable=1, width=500, height=500');
}

function wOpenMejl(mejlid)
{
	window.open('wo_mejl.aspx?id='+mejlid+'&', 'dn_wo_mejl', 'menubar=0, status=0, scroll=0, resizable=1, width=500, height=500');
}

function wOpenEvent(EventID) {
    if (EventID==0)
    {
    window.open('wo_eventcreate.aspx?', 'wOpenEvent', 'menubar=0, status=0, scroll=0, resizable=1, width=700, height=200');
    }
    else
    {
    window.open('wo_eventedit.aspx?nEventID=' + EventID + '&', 'wOpenEvent', 'menubar=0, status=0, scroll=0, resizable=1, width=900, height=600');
    };
}

function wOpenMejlTo(mid)
{
	window.open('wo_mejl_change.aspx?nToMemberID='+mid+'&', 'dn_wo_mejl', 'menubar=0, status=0, scroll=0, resizable=1, width=500, height=500');
}

function wOpenBigImage(mid)
{
	window.open(mid, 'OpenBigImage', 'menubar=0, status=0, scroll=0, resizable=1, width=800, height=600');
}

function eMarkAll(w, v, b)
{
	var aBoxes = w.document.getElementsByTagName("input");
	for (i=0; i<aBoxes.length; i++)
		if (aBoxes[i].name==v)
			aBoxes[i].checked = b;
}
function eMarkCheck(w, v)
{
	var bIsAllMarked = false;
	var aBoxes = w.document.getElementsByTagName("input");
	if (0<aBoxes.length)
	{
		bIsAllMarked = true;
		for (i=0; i<aBoxes.length && bIsAllMarked; i++)
			if (aBoxes[i].name==v)
				bIsAllMarked = aBoxes[i].checked;
	}
	
	w.document.getElementById('boxMarkAll').checked = bIsAllMarked;
}

function wOpenContribution(p)
{
	window.open('wo_forum_contribution_change.aspx?'+p+'&', 'dn_wo_contribution', 'menubar=0, status=0, scroll=0, resizable=1, width=500, height=500');
}

function eC(obj, max)
{
	var l = obj.value.length
	var c = document.getElementById('spanCounter');
	c.innerHTML = (max-l) + ' kvar';
	
	if (max<l)
	{
		alert('Nu överskred du gränsen!\n\nMax '+max+' tecken');
		obj.value = obj.value.substring(0, max);
		eC(obj);
	}
	
	if (l==0)
		c.style.visibility = 'hidden';
	else
		c.style.visibility = 'visible';
}

