var VIEWER_DIV_ID = 'carpet_view';
var LOADER_DIV_ID = 'loader';
var LOGO = 'logo';
function viewInCarpetView(address) {
	new Ajax.Updater('carpet_view', address, { method: 'get', evalScripts:true });
}
function showViewer() {
      /*

	if(document.getElementById(VIEWER_DIV_ID).style.display!='none') {
		Effect.multiple(VIEWER_DIV_ID, Effect.Fade);
	}*/
	//	Effect.multiple(VIEWER_DIV_ID,Effect.BlindDown);
		Effect.BlindDown(VIEWER_DIV_ID, {queue:{position:'front',scope:'pagescope'}});
		Effect.ScrollTo(VIEWER_DIV_ID, {queue:{position:'end',scope:'pagescope'}});
		
//		document.getElementById(VIEWER_DIV_ID).style.display='block';
	}
function loading() {
	Effect.Pulsate(LOADER_DIV_ID);
}
function showSample(divId) {
	if(this.document.getElementById(divId).style.display!='none') {
		
	//	Effect.Opacity(divId, {from: 1, to:0, duration: 2, queue:{position:'front', scope:'samplescope'}});
	//	Effect.Opacity(divId, {from: 0, to:1, duration: 2, queue:{position:'end', scope:'samplescope'}});
	} else {
		Effect.BlindDown(divId,{queue:{position:'end',scope:'samplescope'}});
	}
		Effect.ScrollTo(divId, {queue:{position:'end',scope:'samplescope'}});
	
}
function hideViewer()  {
	if(document.getElementById(VIEWER_DIV_ID).style.display=='none') {
	
	} else {
		Effect.BlindUp(VIEWER_DIV_ID);
		}
//		 return false;
//		document.getElementById(VIEWER_DIV_ID).style.display='none';
	}
function openWindow(address,update_carpet_view_url) {
	my_window = window.open(address,"cip_popup","status=1,width=350,height=150");
	my_window.onunload = function() {
		new Ajax.Updater(VIEWER_DIV_ID, update_carpet_view_url, { method: 'post',evalScripts:true });
	}
}
function openWindowAndRefreshAfter(address) {
	my_window = window.open(address,"cip_popup","status=1,width=450,height=550");
	my_window.onunload = function() {
		location.reload(true);
	}
}
function openWindow(address,update_carpet_view_url,update_element_id) {
	my_window = window.open(address,"cip_popup","status=1,width=350,height=500");
	my_window.onunload = function() {
		new Ajax.Updater(update_element_id, update_carpet_view_url, { method: 'post',evalScripts:true });
	}
}
function postDeleted(post_id) {
	Effect.BlindUp('post_item_'+post_id);
	Effect.BlindUp('submenu_item_'+post_id);
	//Effect.BlindUp('submenu_item_'+post_id,{queue:{position:'end'}});
}
