// JavaScript Document
 
window.onfocus = function() { document[document.all ? 'onkeydown' : 'onkeypress'] = register; }
function register(e)
{
if (document.all) 
{
e = window.event;
target = e.srcElement;
}
else target = e.target;

if(target.tagName == "TEXTAREA" || target.tagName == "INPUT" || e.ctrlKey || e.altKey || e.shiftKey) return;
	var key = String.fromCharCode(document.all ? e.keyCode : e.charCode).toLowerCase();
	/* if (key == 's') { document.form.submit(); } */
}

function deleterow_noconfirm(tableid, rowIndex)
{
	document.getElementById(tableid).deleteRow(rowIndex)
	return true ;
}

function percentscroll(element,percent)
{

	var total = document.getElementById(element).scrollHeight;
	var output = total*percent;
	
	document.getElementById(element).scrollTop = output;
}
function showhide(ElementName)
{
	ElementId = document.getElementById(ElementName);
     if (ElementId.style.display == 'none')
     {
          ElementId.style.display = 'block';
     }
     else
     {
          ElementId.style.display = 'none';
     }
}
function insRow()
{
	var x=document.getElementById('content').insertRow(1)
	var a=x.insertCell(0)
	var b=x.insertCell(1)
	a.innerHTML="<div style='padding:10px'><b>Main Keyword</b><br><input type='text' name='mainkey[]'></div>"
	b.innerHTML="<div style='padding:10px'><b>Sub Keywords</b><br><textarea name='keywords[]' cols='60' rows='5'></textarea><br><input name='button' type='button' onClick='deleterow(this.parentNode.parentNode.parentNode.rowIndex)' value='Delete Key Word Set'></div>"
}
function insRowseed()
{
	var x=document.getElementById('content').insertRow(1)
	var a=x.insertCell(0)
	var b=x.insertCell(1)
	a.innerHTML="<div style='padding:10px'><b>Seed Article</b></div>"
	b.innerHTML="<div style='padding:10px'>Seed Text<br><textarea name='seed[]' cols='60' rows='20'></textarea><br><input name='button' type='button' onClick='deleterow(this.parentNode.parentNode.parentNode.rowIndex)' value='Delete This Seed Text'></div>"
}
function deleterow(rowIndex)
{
	var agree=confirm("Are you sure you to Delete this Row?");
	if (agree){
		document.getElementById('content').deleteRow(rowIndex)
		return true ;
	} else {
		return false ;
	}
}
function confirmation(url)
{
	var answer = confirm("Are you sure you want to Delete This")
	if(answer){
		window.location = url;
	}
}
function confirmationcat(url)
{
	var answer = confirm("Deleting a Category will affect all sites associated with it!\nAre you sure you want to continue?")
	if(answer){
		window.location = url;
	}
}
function gotourl(url)
{
	window.location = url;
}
function confirmmove(url)
{
	var agree=confirm("Are you sure you to Leave this page?");
	if (agree){
		window.location = url;
		return true ;
	} else {
		return false ;
	}
}
function confirmSubmit(message){
	var agree=confirm("Are you sure you to " + message);
	if (agree)
		return true ;
	else
		return false ;
}

function editcat(url){
	window.open(url,'name','toolbar=no,resizable=yes,scrollbars=yes,width=484,height=604');
}
function openbig(url){
	window.open(url,'name2','toolbar=no,resizable=yes,scrollbars=yes,width=484,height=604');
}
function editdir(url){
	window.open(url,'name3','toolbar=no,resizable=yes,scrollbars=yes,width=484,height=604');
}

function setbg(form){
	form.style.borderColor='black'
}
function setback(form){
	form.style.backgroundColor='white'
	form.style.borderColor=''
}
function msoverform(form){
	form.style.backgroundColor='FFCC99'
}