var all_image_collapse	= "clps.png";
var all_image_expand	= "expn.png";
var image_collapse	= "min.png";
var image_collapse2	= "minspec.png";
var image_expand	= "max.png";
var image_expand2	= "maxspec.png";




function toggleAll()
{

	objImage = document.getElementById("channel_view");
	all_current_image_path = objImage.src;
	all_current_image = all_current_image_path.substring(all_current_image_path.lastIndexOf("/") + 1, all_current_image_path.length);

	divArray = document.getElementsByTagName("div");
	for(i=0; i < divArray.length; i++) {

		if(divArray[i].id.substr(0,14) == 'channel_block_') {
			channel_id_array = divArray[i].id.split("_");
			channel_id = channel_id_array[2];

			if(all_current_image == all_image_collapse) {
				Element.hide(divArray[i].id);
				expandPicture("channel_view_image_" + channel_id);
				} else if(all_current_image == all_image_expand) {
				Element.show(divArray[i].id);
				collapsePicture("channel_view_image_" + channel_id);
				}
			}
		}

	if(all_current_image == all_image_collapse) {
		objImage.src = all_current_image_path.substring(0, all_current_image_path.lastIndexOf("/") + 1) + all_image_expand;
		document.getElementById("expcol").innerHTML='EXPAND ALL';
		} else if(all_current_image == all_image_expand) {
		objImage.src = all_current_image_path.substring(0, all_current_image_path.lastIndexOf("/") + 1) + all_image_collapse;
		document.getElementById("expcol").innerHTML='COLLAPSE ALL';
		}

}


function togglePicture(effect)
{
	channel_id_array = effect.element.id.split("_");
	channel_id = channel_id_array[2];
	objImage = document.getElementById("channel_view_image_" + channel_id);
	current_image_path = objImage.src;
	current_image = current_image_path.substring(current_image_path.lastIndexOf("/") + 1, current_image_path.length);

	if(current_image == image_collapse) {
		new_image = image_expand;
		} else if(current_image == image_collapse2) {
		new_image = image_expand2;
		} else if(current_image == image_expand) {
		new_image = image_collapse;
		} else if(current_image == image_expand2) {
		new_image = image_collapse2;
		}

	objImage.src = current_image_path.substring(0, current_image_path.lastIndexOf("/") + 1) + new_image;

	set_blog_height(1);
}

function expandPicture(picture_id)
{
	image = document.getElementById(picture_id);
	image_curr = image.src.substring(image.src.lastIndexOf("/") + 1, image.src.length);

	if (image_curr==image_collapse) {
		image.src = image.src.substring(0, image.src.lastIndexOf("/") + 1) + image_expand;
		} else if (image_curr==image_collapse2) {
		image.src = image.src.substring(0, image.src.lastIndexOf("/") + 1) + image_expand2;
		}

set_blog_height(1);
}

function collapsePicture(picture_id)
{
	image = document.getElementById(picture_id);
	image_curr = image.src.substring(image.src.lastIndexOf("/") + 1, image.src.length);

	if (image_curr==image_expand) {
		image.src = image.src.substring(0, image.src.lastIndexOf("/") + 1) + image_collapse;
		} else if (image_curr==image_expand2) {
		image.src = image.src.substring(0, image.src.lastIndexOf("/") + 1) + image_collapse2;
		}

set_blog_height(1);
}


function makeAllVisible()
{
	objImage = document.getElementById("channels_visible");

	divArray = document.getElementsByTagName("div");
	for(i=0; i < divArray.length; i++) {
		if(divArray[i].id.substr(0,20) == 'channel_close_frame_') {
			Element.show(divArray[i].id);
			}
		}

}










function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}








function movecomicbottom() {
objForm = document.getElementById("rightbox");
if (objForm.selectedIndex>-1) { 
	for (i=objForm.selectedIndex;i<objForm.length-1;i++) { switchvalues(objForm,i,i+1); }
	}
}

function movecomictop() {
objForm = document.getElementById("rightbox");
if (objForm.selectedIndex>0) { 
	for (i=objForm.selectedIndex;i>0;i--) { switchvalues(objForm,i,i-1); }
	}
}

function movecomicdown() {
objForm = document.getElementById("rightbox");
if (objForm.selectedIndex>-1 && objForm.length-objForm.selectedIndex>1) { switchvalues(objForm,objForm.selectedIndex,objForm.selectedIndex+1); }
}

function movecomicup() {
objForm = document.getElementById("rightbox");
if (objForm.selectedIndex>-1 && objForm.selectedIndex>0) { switchvalues(objForm,objForm.selectedIndex,objForm.selectedIndex-1); }
}


function switchvalues(object,val1,val2) {
priv=object.options[val1].text;
priv2=object.options[val1].value;

object.options[val1].text=object.options[val2].text;
object.options[val1].value=object.options[val2].value;

object.options[val2].text=priv;
object.options[val2].value=priv2;
object.selectedIndex=val2;
}




function removecomic() {
objForm = document.getElementById("rightbox");


for (i=0;i<objForm.length;i++) {
	if (objForm.options[i].selected == true) {
		alert(objForm.options[i].text);
//		movecomicbottom();
//		objForm.length = objForm.length-1;
		}
	}




//if (objForm.selectedIndex>-1) { 
//	movecomicbottom();
//	objForm.length = objForm.length-1;
//	}
}





function addcomic() {

objForm = document.getElementById("leftbox");
secForm = document.getElementById("rightbox");

var cannotmove=0;

if (objForm.selectedIndex>-1) { 

	for (i=0;i<secForm.length;i++) {
		if (secForm.options[i].value==objForm.options[objForm.selectedIndex].value) { cannotmove=1; }
		}

	if (cannotmove!=1) {
		secForm.length=secForm.length+1;
		secForm.options[secForm.length-1].value=objForm.options[objForm.selectedIndex].value;
		secForm.options[secForm.length-1].text=objForm.options[objForm.selectedIndex].text;
		}
	}

}






function resetcustomization() {

}









function selectAll(theSelect) {
	for (var i=0,n=theSelect.options.length; i<n; i++) {
		theSelect.options[i].selected = true;
		return true;
		}
	}







function getTopPos(obj_id) {
	var obj=document.getElementById(obj_id);
	var curleft = curtop = 0;

	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
//		if (document.all) {
			while (obj = obj.offsetParent) {
				curleft += obj.offsetLeft
				curtop += obj.offsetTop
				}
//		}
	}

	return curtop;
}


function set_blog_height(shrink_first) {
return false;
	if (document.getElementById('bloglines')) {
		if(shrink_first==1) { document.getElementById('bloglines').style.height='1px'; }
		document.getElementById('bloglines').style.height = (getTopPos('footer') - getTopPos('bloglines')) + 'px';
		}
	}






MM_preloadImages('/images/sbmit_over.png','/images/search_btn_over.png','/images/more_over.png');


