function manage_tag(objId){

	if(document.getElementById(objId).style.visibility == 'visible'){

		document.getElementById(objId).style.visibility = 'hidden';

	} else {

		document.getElementById(objId).style.visibility = 'visible';

	} 

}



function submit_digg(url,title,description,topic){

	url_link = "http://digg.com/submit?phase=2&url=" + encodeURIComponent(url) + "&title=" + encodeURIComponent(title) + "&bodytext=" + encodeURIComponent(description) + "&topic=" + encodeURIComponent(topic);

	window.open(url_link);

}

function submit_reddit(url,title){

	url_link='http://reddit.com/submit?url='+encodeURIComponent(url)+'&title='+encodeURIComponent(title)	

	window.open(url_link);

}

function swap_img(imgName,imgurl) {

    document[imgName].src = imgurl;

}

function swap_caption1(objectID,caption){

	caption = escape(caption);

	document.getElementbyId(objectID).innerText=caption;

}

function swap_caption2(objectID,caption){

	document.getElementbyId(objectID).innerHTML=caption;

}

function swap_pics(imgNames,imgurl,cap_id,caption){

	document.getElementById(cap_id).innerHTML=caption;

	document[imgNames].src = imgurl;	

}

function pop_window(iWidth,iHeight,iUrl){

	day = new Date();

	id = day.getTime();

	eval("page" + id + " = window.open(iUrl, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + iWidth + ",height=" + iHeight + ",left = 428.5,top = 300.5');");	

}

function pop_window2(iWidth,iHeight,iUrl){

	day = new Date();

	id = day.getTime();

	iUrl = change_src(iUrl);

	eval("page" + id + " = window.open(iUrl, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + iWidth + ",height=" + iHeight + ",left = 428.5,top = 300.5');");	

}

function imgswap(imgName,imgurl) {

	document[imgName].src = imgurl;

}

	

function show_option(id){

	var objID = document.getElementById(id);

	objID.style.display='block';

	objID.style.visibility='visible';                                                                                       

}

	

function hide_option(id){

	var objID = document.getElementById(id);

	objID.style.display='none';       

	objID.style.visibility='hidden'    

 }           

function handle_event2(imgName,imgURL,obj_hide,obj_show,buy_id,buy_url){

	var lid = document.getElementById(buy_id);

	buy_url = encodeURI(buy_url);

	lid.href = buy_url;

	imgswap(imgName,imgURL);

	hide_option(obj_hide);

	show_option(obj_show);

}

function handle_event3(imgName,imgURL,obj_hide,obj_show,buy_id,buy_url,pop_id,pop_url){
	var lid = document.getElementById(buy_id);
	buy_url = encodeURI(buy_url);
	lid.href = buy_url;
	imgswap(imgName,imgURL);
	hide_option(obj_hide);
	show_option(obj_show);
	var pid = document.getElementById(pop_id);
	pop_url = encodeURI(pop_url);
	pid.href = pop_url;
}

function change_src(imgSrc){

	var str = imgSrc;

	var tmp = str.substring(0,str.length - 4);

	tmp = tmp + "-lg.gif";

	return tmp;

}

function show_content(id){

	var objid = id;

	hide_option('w_cubes');

	hide_option('w_cubes_a');		

	hide_option('w_cubes_p');	

	<!--hide_option('w_cubes_custom');-->	

	show_option(id);

}

function show_option(id){

	document.getElementById(id).style.display='block';

	document.getElementById(id).style.visibility='visible';						

}

function hide_option(id){

	var objId=id;

	document.getElementById(objId).style.display='none';	

	document.getElementById(objId).style.visibility='hidden'				

}


function toggle_image(id,img1,img2){
	
	//get image source:
		var tmp
		tmp = document.getElementById(id).src; 
	
	//strip path from image names:
		currentname = tmp.substring(tmp.lastIndexOf("\/")+1);
		img1name =  img1.substring(img1.lastIndexOf("\/")+1);
	
		/*alert("currentname: "+ currentname + " & img1name:" + img1name);*/

	// Change the image:	
	if(currentname == img1name){
		document.getElementById(id).src = img2
	} else {
		document.getElementById(id).src = img1
	}
}

