if (top.location != location) {
    top.location.href = document.location.href ;
}

function addslashes( str ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Ates Goral (http://magnetiq.com)
    // +   improved by: marrtins
    // *     example 1: addslashes("kevin's birthday");
    // *     returns 1: "kevin\'s birthday"
 
    return str.replace('/(["\'\])/g', "\\$1").replace('/\0/g', "\\0");
}

/* Manage font size on site */
var min=8;
var max=12;
function increaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("pt",""));
      } else {
         var s = 9;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"pt"
   }
}

function decreaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("pt",""));
      } else {
         var s = 9;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"pt"
   }   
}

function appendBreadcrumb(url, title) {
	var breadcrumbs = document.getElementById('breadcrumb').innerHTML;
	breadcrumbs += ' &gt; <a href="' + url + '">' + title + '</a>';
	document.getElementById('breadcrumb').innerHTML = breadcrumbs;	
}

//Submits the form
function doSubmit() {
	document.admin.submit();
}

function SelectSubCat(){


// ON selection of category this function will work

removeAllOptions(document.drop_list.secondary_id);

addOption(document.drop_list.secondary_id, "", "-Secondary Category-", "");
var id = document.drop_list.primary_id.value;
 drop_list.submit(); 

}
////////////////// 



function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		//selectbox.options.remove(i);
		selectbox.remove(i);
	}
}


function addOption(selectbox, value, text )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;

	selectbox.options.add(optn);
}



