// JavaScript Document
	
//log off functionality where screen colour changes
function logoff()
{
	ht_1 = document.getElementsByTagName("body");		
	
	ht_1[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1, xray=0, mirror=0, invert=0, opacity=.65, rotation=0)";

	if(confirm("Are you sure you want to log out?"))
	{
		return true;
	}
	else
	{
		ht_1[0].style.filter = "";
		return false;
	}
}

function toggleObject(ObjectID) 
{
	var currentObject = null;	
	ObjectHolder = document.getElementById("Object" + ObjectID);
	
	if(ObjectHolder.style.display == "none") 
	{
		ObjectHolder.style.display = "block";
	}
	else 
	{
		ObjectHolder.style.display = "none";
	}	
}

function del_article(Index)
{
	if(confirm("Confirm this delete?"))
	{
		location.href = "update.asp?delete="+Index;
	}
	else
	{	
		//do nothing
	}
}

function deactivate_article(Index,type)
{
	if(confirm("Deactivate this "+type+"?"))
	{
		location.href = "update.asp?deactivate="+Index;
	}
	else
	{	
		//do nothing
	}
}

function activate_article(Index,type)
{
	if(confirm("Activate this "+type+"?"))
	{
		location.href = "update.asp?activate="+Index;
	}
	else
	{	
		//do nothing
	}
}


var win=null;
  
function pop_window(mypage,myname,w,h,scroll,status,pos)
{
	if(pos=="center")
	{
 		LeftPosition=(screen.width)?(screen.width-w)/2:100;
  		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	else if((pos!="center" && pos!="random") || pos==null)
	{
  		LeftPosition=0;
  		TopPosition=20;
	}

settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status='+status+',menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);
}

function limitChar()
{
	var strValue = document.replier.txtTeaser.value
	var strLen = strValue.length
	if (strLen >= 151)
	{
		document.replier.txtPara1.blur()
		alert("You Have Exceeded The Limit Of 150 Characters")
		var strNew = strValue.substring(0, 151)
		document.replier.txtTeaser.value = strNew
		document.replier.txtTeaser.focus()
		return false
	}
}	

var win=null;
  
//open a pop up window 
function open_window(mypage,myname,w,h,scroll,status,pos)
{
LeftPosition=(screen.width)?(screen.width-w)/2:100;
TopPosition=(screen.height)?(screen.height-h)/2:100;
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status='+status+',menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);
}

//make sure at least a title is added in the cms
function verifyTitle()
{
  
	var themessage = "Please enter the following details:\n\n";
	
	if(document.replier.txtTitle.value=="")
	{
		themessage += "-  A title\n";
	}

	
	if (themessage == "Please enter the following details:\n\n") 
	{

	}
	else 
	{
		alert(themessage);
		event.returnValue=false;	
		return false;
	}	
}

function verifySalesList()
{
  
	var themessage = "Please enter the following details:\n\n";
	
	if(document.replier.txtISBN.value=="")
	{
		themessage += "-  An ISBN\n";
	}
	
	if(document.replier.txtCoverTitle.value=="")
	{
		themessage += "-  A Cover Title\n";
	}	

	
	if (themessage == "Please enter the following details:\n\n") 
	{

	}
	else 
	{
		alert(themessage);
		event.returnValue=false;	
		return false;
	}	
}

function verifyWarehouse()
{
  
	var themessage = "Please enter the following details:\n\n";
	
	if(document.replier.txtWarehouse.value=="")
	{
		themessage += "-  A name\n";
	}

	
	if (themessage == "Please enter the following details:\n\n") 
	{

	}
	else 
	{
		alert(themessage);
		event.returnValue=false;	
		return false;
	}	
}

function verifyNewsletter()
{
  
	var themessage = "Please enter the following details:\n\n";
	
	if(document.newsletter.email.value=="")
	{
		themessage += "-  An email address\n";
	}

	
	if (themessage == "Please enter the following details:\n\n") 
	{

	}
	else 
	{
		alert(themessage);
		event.returnValue=false;	
		return false;
	}	
}

function verifyKeywordSearch()
{
  
	var themessage = "Please enter the following details:\n\n";
	
	if(document.keyword.keyword.value=="")
	{
		themessage += "-  At least one keyword\n";
	}

	
	if (themessage == "Please enter the following details:\n\n") 
	{

	}
	else 
	{
		alert(themessage);
		event.returnValue=false;	
		return false;
	}	
}

function checkImageNotEmpty()
{
	if (document.uploader.thumbnailEdit.value == "")
	{
		alert("Please select an image to upload!");
		event.returnValue=false;	
		return false;		
	}
}