	var wbNav, wbIE, wbSafari, wbFirefox, windowHeight, showlogin, divToggle, showCP;
	wbIE = (navigator.userAgent.indexOf("MSIE") !=-1) ? true : false;
	wbSafari = (navigator.userAgent.indexOf("Safari") !=-1) ? true : false;
	wbFireFox = (navigator.userAgent.indexOf("Firefox") !=-1) ? true : false;
	windowHeight = getHeight();
	showlogin = false;
	divToggle = false;
	showCP = false;
	openBoxes = 0;
	
function selectKeywords(targetId,yesOrNo){
	var o = VT_getObjectByID(targetId);
	if (o){
		for (var i = 0; i < o.options.length; i++) {
			o.options[i].selected = yesOrNo;
		}
	}
}

function moveSelectedOptions(source,target) {
	if (source == null || VT_getObjectByID(source).options == null){ 
		return false; 
	}
	for (var i=0; i<VT_getObjectByID(source).options.length; i++){
		var o = VT_getObjectByID(source).options[i];
		if (o.selected){
			if (VT_getObjectByID(source) == null || VT_getObjectByID(source).options == null){ 
				var index = 0; 
			}else{
				var index=VT_getObjectByID(target).options.length;
			}
			VT_getObjectByID(target).options[index] = new Option( o.text, o.value, false, false);
		}
	}
	// Remove them from original
	for (var i=(VT_getObjectByID(source).options.length-1); i>=0; i--){
		var o = VT_getObjectByID(source).options[i];
		if (o.selected){
			VT_getObjectByID(source).options[i] = null;
		}
	}
	VT_getObjectByID(source).selectedIndex = -1;
	VT_getObjectByID(target).selectedIndex = -1;
}

function showHelpPopUp(id,target){
	var obj = VT_getObjectByID(id);
	if (obj){
		VT_showHideObject(id);
		obj.style.top = (getPageCoordinates(target).y);
		obj.style.left = (getPageCoordinates(target).x - parseInt(obj.style.width))-20;
	}
}

//start faq javascript functions
	
	
	function closeAnswers() {
	 	//for each content div, if its height is greater than 2
		var faqdivs = document.getElementsByTagName("DIV");
		for (var i = 0; i < faqdivs.length; i++)
			{
			if (faqdivs[i].id.substring(0,6) == "faqdiv")
				{
				element = faqdivs[i];
			 	//if it's height is true height then close
				if (element.style.height == element.trueheight + 'px')
					{
					speed = 10;
					speed = 0 - speed;
					expandContractDiv(element, element.trueheight, speed);	
					}
				}
			}
	}

	function showanswer(ans) {
		closeAnswers();
		toggleDiv(ans, 10);
	}
	
	function toggleArrow(id,right,down) {
		if (document.getElementById(id).src == down)
		{
		document.getElementById(id).src=right;
		}
		else
		{
		document.getElementById(id).src=down;
		}
	}
	
	
	function resetAllWhiteArrows(domain,id){

	var divs = document.getElementsByTagName( 'img' );
	for ( var i = 0; i < divs.length; i++ ) {
        if ( divs[i].className == 'faq-img2' ) 
			{ 
				if ( divs[i].id != id ) {
				var obj = document.getElementById(divs[i].id);
				obj.src=domain + '/bin/but_arr_white_right.png';
				}
			}
      }
	}

	function resetAllBlueArrows(domain,id){

	var divs = document.getElementsByTagName( 'img' );
	for ( var i = 0; i < divs.length; i++ ) {
        if ( divs[i].className == 'faq-img1' ) 
			{ 
				if ( divs[i].id != id ) {
				var obj = document.getElementById(divs[i].id);
				obj.src=domain + '/bin/but_arr_blue_right.png';
				}
			}
      }
	}

//end faq javascript functions


function chooseAccessOptions(thisId,targetId,targetTotalNumber){
	var obj = VT_getObjectByID(thisId);
	if (obj) {
		if ( obj.value == 1) {
			
			for (var i = 0; i<VT_getObjectByID(targetTotalNumber).value; i++){
				var targetObj = VT_getObjectByID(targetId + i);
				if (targetObj) {
					//targetObj.checked = false;
					targetObj.disabled = true;
				}
			}
		}else{
			for (var i = 0; i<VT_getObjectByID(targetTotalNumber).value; i++){
				var targetObj = VT_getObjectByID(targetId + i);
				if (targetObj) {
					//targetObj.checked = false;
					targetObj.disabled = false;
				}
			}		
		}
	}
}

function buildThumbAccessLevel(theId,targetId){

	var o = VT_getObjectByID(targetId);
	var source = VT_getObjectByID(theId);
	if(o && source){
		if(o.value){
			if (source.checked){
				o.value = parseInt(o.value) + parseInt(source.value);
			}else{
				o.value = parseInt(o.value) - parseInt(source.value);
			}
		}else{
			if (source.checked){
				o.value = parseInt(source.value);
			}
		}
	}

	
}

function clearSections(target1,target2,target3,target4){
	var obj1 = VT_getObjectByID(target1);
	if (obj1){
		obj1.value = "";
	}
	var obj2 = VT_getObjectByID(target2);
	if (obj2){
		obj2.value = "";
	}
	var obj3 = VT_getObjectByID(target3);
	if (obj3){
		obj3.value = "";
	}
	var obj4 = VT_getObjectByID(target3);
	if (obj4){
		obj4.value = "";
	}

	setCookie("section",0,1);
}

function setCookie(cookieName,cookieValue,expireDays)
{
	var adate = new Date();
	adate.setDate(adate.getDate() + expireDays);
	
	document.cookie=cookieName + "=" + escape(cookieValue) + ((expireDays==null) ? "" : ";expires=" + adate.toGMTString() + '; path=/');
	//alert(cookieName + ' ' + escape(cookieValue));
	//alert('Real = ' + VT_getObjectByID('section').value);
}

function removeCategoryValue(targetId,valueToRemove){
	var aValue = valueToRemove;
	var o = VT_getObjectByID(targetId);
	if(o && aValue){
		o.value = o.value - parseInt(aValue.split(',')[1]);
		//setCookie("section",o.value,1);
		//alert('remove');
	}
}


function buildValue(targetId,theId,thevalue,stringPosition){
	var aValue = thevalue;
	var o = VT_getObjectByID(targetId);
	if(o){
		if(stringPosition==0 && targetId != 'section'){
			o.value = aValue.split(',')[stringPosition];
		}else{
			if(!o.value){
				o.value = aValue.split(',')[stringPosition];
				if (targetId == 'section') {setCookie("section",o.value,1);}
				//alert('empty');
			}else{
			var box = VT_getObjectByID(theId);
			if(box){
				if (box.checked){
					o.value = parseInt(o.value) + parseInt(aValue.split(',')[stringPosition]);
					if (targetId == 'section') {setCookie("section",o.value,1);}
					//alert('added cat');
				}else{
					o.value = parseInt(o.value) - parseInt(aValue.split(',')[stringPosition]);
					if (targetId == 'section') {setCookie("section",o.value,1);}
					//alert('removed cat');
					}
				}
			}

		}
	}
}

function showCircle(id)
{
	var obj = VT_getObjectByID(id);
	if(obj){
		if(obj.style.visibility == "hidden" || obj.style.visibility == ""){
			obj.style.visibility = "visible";
			obj.style.display = "";
		}
	}
}

function populateEvent(theId,theInnerHTMLID,uid){
	var o = VT_getObjectByID(theId);

	var info = VT_getObjectByID(theInnerHTMLID);
	if(o && info){
		if(o.name ==undefined){
			o.name = '<br>' + info.name;
		}else{
			o.name = o.name + '<br>' + info.name; 
		}
		o.innerHTML = o.innerHTML + '<br>' + info.value;
	}
}

function populateFinder(theId,theInnerHTMLID,uid){
	var o = VT_getObjectByID(theId);
	var info = VT_getObjectByID(theInnerHTMLID);
	if(o && info){
		o.innerHTML = info.innerHTML;
	}
}

function setSubCategory(id,theHiddenField){
	var o = VT_getObjectByID(id); 
	if(o){
		if(o.checked == false){
			var x = VT_getObjectByID(theHiddenField); 
			if(x){
				if(x.value){
					x.value = (parseInt(x.value)-parseInt(o.value));
				}
			}
		}
		if(o.checked==true){
			var y = VT_getObjectByID(theHiddenField);
			if(y){
				if(y.value){
					y.value = (parseInt(y.value)+parseInt(o.value));
				}else{
					y.value = parseInt(o.value);
				}
			}
		}
	}
}

function changeStar(id,totalStars,css){
	var o = VT_getObjectByID(id);
	if(o){
		o.style.cursor='pointer';
		var star = o.id.split("-")[1];
		var beginID = o.id.split("-")[0];
		if(star<totalStars){
			if(parseInt(star)>0){
				for (var i=0; i<=star; i++){
					changeCSS(beginID + '-' +i,css)
				}
			}else{
				changeCSS(id,css);
			}
		}else{
			for (var i=0; i<=totalStars; i++){
					var theID = beginID + '-' +i;
					//alert(theID);
					changeCSS(theID,css);
			}
		}
	}
}

function submitRating(id,did,url){
	var o = VT_getObjectByID(id);
	if(o){
		var rating = parseInt(o.id.split("-")[1])+1;
		document.location = url + did + ',' + rating; 
	}
}

function setNoteText(id,theText){
	var o = VT_getObjectByID(id);
	if(o){
		var no = findNodeByMessageId(o);
		if (no) {no.innerHTML=theText;}
		}
}

function findNodeByMessageId(obj,id) {
	var result = false;
	for (var i = 0; i < obj.childNodes.length; i++)
		{
		if (obj.childNodes[i].hasChildNodes()) {result = findNodeByMessageId(obj.childNodes[i],id)}
		if (result) {return result;}
		if (obj.childNodes[i].id)
			{
			if (obj.childNodes[i].id.substring(0,7) == 'message') {return obj.childNodes[i];}
			}
		}
	return result;
}

function setNote(id,obj){
	var theStyle = obj.value
	var o = VT_getObjectByID(id);
	if(o){
		if(theStyle==-1){
			o.className='note-1';
		}else{
			o.className='note-' + theStyle.split("-")[1];
		}
		if (o.className == 'note-1')
			{
			var no = findNodeByMessageId(o);
			if (no) {no.style.color = 'black';}
			o.style.width = '232';
			o.style.height = '304';
			}
		if (o.className == 'note-2')
			{
			var no = findNodeByMessageId(o);
			if (no) {no.style.color = 'white';}
			o.style.width = '184';
			o.style.height = '248';
			}
		if (o.className == 'note-3')
			{
			if (function() {if (o.firstChild && o.firstChild.className == 'deletenotehide') {if (o.innerHTML.length > 598) {return true;} else {return false;}} else { if (o.innerHTML.length > 80) {return true;} else {return false;}}}())
				{
				var no = findNodeByMessageId(o);
				if (no) {no.style.color = 'blue';}
				o.className = 'note-1';
				o.style.width = '232';
				o.style.height = '304';
				alert('Text too long for chosen note style. Maximum text length for style 3 is 80 characters.');
				obj.selectedIndex = 0;
				}
			else
				{
				var no = findNodeByMessageId(o);
				if (no) {no.style.color = 'blue';}
				o.style.width = '168';
				o.style.height = '98';
				}
			}
			
	}
}

function showSchemeDes(target,id){
	var o = VT_getObjectByID(target);
	var obj = VT_getObjectByID(id);
	if(o && obj){
		VT_showHideObject(target);
		if(parseInt(obj.className.split("_")[2])==1){
			obj.className = obj.className.split("_")[0] + "_" + obj.className.split("_")[1] + "_" + 2; 
		}else{
			obj.className = obj.className.split("_")[0] + "_" + obj.className.split("_")[1] + "_" + 1;
		}
	}
}

function showAdmin(id,classNameOver,classNameOut,e){
	var o = VT_getObjectByID(id);
	if(o){
		if(getEvent(e).type == 'mouseover'){
			o.className=classNameOver;
		}else{
			o.className=classNameOut;
		}
	}
}

function showDiv(id,posContainer){
	var o = VT_getObjectByID(id);
	if(o){
		if(o.style.visibility=='hidden'){
			o.style.display='block';
			o.style.visibility='visible';
			openBoxes++;
			
			if(document.body.scrollTop >= 0 && posContainer){
				VT_getObjectByID(posContainer).style.paddingTop=((document.body.scrollTop+220));
			}
			o.style.height=document.body.scrollHeight;
			o.style.width=document.body.scrollWidth;
			divToggle=true;
		}else{
			o.style.display='none';
			o.style.visibility='hidden';
			openBoxes--;
			divToggle=false;
		}

	}
}

function showLogin(){
	var o = VT_getObjectByID('loginblocker');
	if(o){
		if(!showlogin){
			if(document.body.scrollTop > 10){
				VT_getObjectByID('logSize').style.paddingTop=((document.body.scrollTop+220));
			}
			o.style.display='block';
			o.style.visibility='visible';
			o.style.height=document.body.scrollHeight;
			o.style.width=document.body.scrollWidth;
			showlogin=true;
			VT_getObjectByID('username').focus();

		}else{
			o.style.display='none';
			o.style.visibility='hidden';
			showlogin=false;
		}
		showDivs("buttons");
	}
}

function showChangePassword(){
	var o = VT_getObjectByID('cpblocker');
	if(o){
		if(!showCP){
			o.style.display='block';
			o.style.visibility='visible';
			o.style.height=document.body.scrollHeight;
			o.style.width=document.body.scrollWidth;
			password_field = VT_getObjectByID('newpassword1');
			password_field.focus();
			showCP=true;
		}else{
			o.style.display='none';
			o.style.visibility='hidden';
			showCP=false;
		}
	}else{
		alert('not found');
	}
}

function getObjectCoordinates(e){

	//returns two params x,y with position values relative to the object

	if(wbFireFox){return {x:e.layerX, y:e.layerY};}
	else{
		if(wbSafari){return {x:getEvent(e).offsetX, y:getEvent(e).offsetY};}
		else{
			return {x:getEvent(e).offsetX, y:getEvent(e).offsetY + document.body.scrollTop};
		}
	}
}

function getMouseOffset(target, e){
	e = getEvent(e);

	var docPos = getPositionByEvent(target);
	var mousePos = getPageCoordinates(e);
	return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
}

function getPositionByEvent(e){
	var left = 0;
	var top  = 0;

	while (e.offsetParent){
		left += e.offsetLeft;
		top += e.offsetTop;
		e = e.offsetParent;
	}

	left += e.offsetLeft;
	top += e.offsetTop;

	return {x:left, y:top};
}

function getObjectPositionByObject(Object){
	var o = Object;
	if(o){
		var left = 0;
		var top = 0;
		while (o.offsetParent){
			left += o.offsetLeft;
			top += o.offsetTop;
			o = o.offsetParent;
		}
	
		left += o.offsetLeft;
		top += o.offsetTop;
	}
	return {x:left, y:top};
}

function stripChars(value,strings){
	var theString;
	theString = value;
	if(theString){
		theString = theString.replace(strings,'');
		return theString;
	}
}

function getDivCorners(object,mousex,mousey,relclickposx,relclickposy){
	if(object){
		return {topLeftx: mousex - relclickposx, topLefty: mousey - relclickposy, topRightx: (mousex - relclickposx) + parseInt(stripChars(object.style.width,'px')), topRighty: mousey - relclickposy, bottomLeftx: mousex - relclickposx , bottomLefty: (mousex - relclickposx) + parseInt(stripChars(object.style.height,'px')), bottomRightx: (mousex - relclickposx) + parseInt(stripChars(object.style.width,'px')), bottomRighty: (mousey - relclickposy) + parseInt(stripChars(object.style.height,'px'))};
	}
}

function getPageCoordinates(e){

	//returns two objects x,y with position values relative to the page

	if(wbFireFox){return {x:e.pageX, y:e.pageY};}
	else{
		if(wbSafari){return {x:getEvent(e).clientX, y:getEvent(e).clientY};}
		else{
			return {x:getEvent(e).clientX + document.body.scrollLeft - document.body.clientLeft, y:getEvent(e).clientY + document.body.scrollTop - document.body.clientTop};
		}
	}
}

function getEvent(e) 
{
 	if (!e)e=window.event; 
 	return e;
}

function VT_showHideObject(id)
{
	var obj = VT_getObjectByID(id);
	if(obj){
		if(obj.style.visibility == "hidden" || obj.style.visibility == ""){
			obj.style.visibility = "visible";
			obj.style.display = "";
		}
		else{
			obj.style.visibility = "hidden";
			obj.style.display = "none";
		}
	}
}

function SortVBArray(arrVBArray){
	return arrVBArray.toArray().sort(sortNumber).join('\b');
}
    
function sortNumber(a,b){
	return a - b
}

function go(url,target){
	if(url==''){
		return false;
	}
	else{
		if(target=='' || target=='self' || target=='top')
		{
			document.location=url;
		}
		else if(target=='_blank'){
			window.open(url);
		}
		else if(target=='_parent'){
			parent.location=url;
		}
	}
}

function validTopicReply(){
	var a = VT_getObjectByID('title');
	var b = VT_getObjectByID('reply');
	if(a && b){

		if(a.value=='' || b.value==''){
			alert('Fields marked with an * require a value');
			return false;
		}
		else{
			return true;
		}
	}
	else{
		return false;
	}
}

function validNewTopic(){

	var a = VT_getObjectByID('title');
	var b = VT_getObjectByID('topic');
	if(a && b){
		if(a.value=='' || b.value==''){
			alert('Fields marked with an * require a value');
			return false;
		}
		else{
			return true;
		}
	}
	else{
		return false;
	}
}

function validateRegistration(){
	var a = VT_getObjectByID('regusername');
	var b = VT_getObjectByID('regpassword');
	var c = VT_getObjectByID('cpassword');
	var d = VT_getObjectByID('tandc');
	var e = VT_getObjectByID('email');
	var f = VT_getObjectByID('firstname');
	var g = VT_getObjectByID('surname');
	
	if(a && b && c && d && e && f && g){
		if(a.value=='' || b.value=='' || c.value=='' || d.value=='' || e.value=='' || f.value=='' || g.value==''){
			alert('Fields marked with an * require a value');
			return false;
		}
		else{
			if (b.value != c.value){
				alert('Your passwords do not match, please try again');
				return false;
			}
			
			if (d.checked){
			return true;
			}
			else
			{
				alert('You need to accept the Terms and Conditions to continue to register');
				return false;
			}
		}
	}
	else{
		return false;
	}
}

function validateRegistration2(){
	var a = VT_getObjectByID('uname');
	if (a && b){
		if(a.value==''){
			alert('Please enter a username');
			return false;
		}else{
		
		return true;
		
		}
	}
}

function validateScreenName(){
	var a = VT_getObjectByID('screenname');
	if (a){
		if(a.value==''){
			alert('Please enter a screenname');
			return false;
		}else{
		
		return true;
		
		}
	}
}


function validateLogin(){
	var a = VT_getObjectByID('uname');
	var b = VT_getObjectByID('pword');
	if(a && b){
		if(a.value=='' || b.value==''){
			alert('Username and Password fields must not be blank');
			return false;
		}
		else{
			return true;
		}
	}
	else{
		return false;
	}
}

function validateChangePassword(){
	var a = VT_getObjectByID('newpassword1');
	var b = VT_getObjectByID('newpassword2');
	if(a && b){
		if(a.value=='' || b.value==''){
			alert('Both password boxes must be filled');
			return false;
		}
		if (a.value != b.value){
			alert('Your passwords did not match, please try again');
			a.focus();
			a.value='';
			b.value='';
			return false;		
		}
		return true;
	}
	else{
		return false;
	}
}

function validateRSS(){
	var a = VT_getObjectByID('file2');
	var b = VT_getObjectByID('title');
	var c = VT_getObjectByID('file2');
	var d = VT_getObjectByID('title');
	if(a && b && c && d){
		if(a.value=='' || b.value=='' || c.value=='' || d.value==''){
			alert('Fields marked with an * require a value');
			return false;
		}
		else{
			return true;
		}
	}
	else{
		return false;
	}

}

function validateCMS(){
	var a = VT_getObjectByID('file2');
	var b = VT_getObjectByID('title');
	if(a && b){
		if(a.value=='' || b.value==''){
			alert('Fields marked with an * require a value');
			return false;
		}
		else{
			return true;
		}
	}
	else{
		return false;
	}

}

function validateCategories(){
	var a = VT_getObjectByID('category');
	if(a){
		if(a.value==''){
			alert('Fields marked with an * require a value');
			return false;
		}
		else{
			return true;
		}
	}
	else{
		return false;
	}

}

function changeCSS(id,css){
	var o = VT_getObjectByID(id);
	if(o){
		o.className=css;
	}
}

function getOffset(){
	var  offsetHeight = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
	//Netscape compliant
		offsetHeight = window.pageYOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	//DOM compliant
		offsetHeight = document.body.scrollTop;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	//IE6 standards compliant mode
		offsetHeight = document.documentElement.scrollTop;
	}
	return offsetHeight;
}

function getHeight() {
	var wHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		wHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
		wHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
		wHeight = document.body.clientHeight;
	}
	
	var  offsetHeight = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
	//Netscape compliant
		offsetHeight = window.pageYOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	//DOM compliant
		offsetHeight = document.body.scrollTop;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	//IE6 standards compliant mode
		offsetHeight = document.documentElement.scrollTop;
	}
	//alert(wHeight);
	//alert(offsetHeight);
	return wHeight+offsetHeight;
}

function getWindow(){
	var wHeight = 0;
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			wHeight = window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
			wHeight = document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
			wHeight = document.body.clientHeight;
		}
	return wHeight;
}

function showDivWindow(shadow,container,blocker)
{		
	var thetop=((getWindow()/2)+getOffset());	
	var fillDiv = VT_getObjectByID(blocker); if(fillDiv){fillDiv.style.height=document.body.scrollHeight; fillDiv.style.width=document.body.scrollWidth; fillDiv.style.visibility='visible';}
	var containerShadowDiv = VT_getObjectByID(shadow); if(containerShadowDiv){containerShadowDiv.style.top=thetop; containerShadowDiv.style.visibility='visible';}
	var containerDiv = VT_getObjectByID(container); if(containerDiv){containerDiv.style.top=thetop; containerDiv.style.visibility='visible'; }				
}

function writeInput(sourceId,targetId){
	var source = VT_getObjectByID(sourceId);
	var target = VT_getObjectByID(targetId);
	if(source && target){
		target.innerHTML=source.value;
	}
}

function writeText(targetId,text){
	var target = VT_getObjectByID(targetId);
	if(target){
		target.innerHTML=text;
	}
}

function hideDivWindow(shadow,container,blocker)
{
	var fillDiv = VT_getObjectByID(blocker); if(fillDiv){fillDiv.style.visibility='hidden';}
	var containerShadowDiv = VT_getObjectByID(shadow); if(containerShadowDiv){containerShadowDiv.style.visibility='hidden';}
	var containerDiv = VT_getObjectByID(container); if(containerDiv){containerDiv.style.visibility='hidden';}
}
						
function DeleteCategories(url,id,totalNo){
	var s;
	s = "";						
	for (var i=0;i<totalNo;i++)
	{							
		var o = VT_getObjectByID(id + i);
		if ((o) && (o.checked)) 
		{
			if (s != "") { s = s + ",";}
			s = s + o.value;
		}
	}
	document.location = url + s;
}

function getCheckBoxs(formField,maxNumber){
	var result;
	result ="";
	for (var i=0;i<maxNumber;i++)
	{	
		var target = VT_getObjectByID(formField + i);
		if ((target) && (target.checked)) 
		{
		if (result != ""){ 
			result = result + ",";
		}
		result = result + target.value;
		}
	}
	return result
}

function getChannels(id,totalNo,target){	
	var s;
	s = "";						
	for (var i=0;i<totalNo;i++)
	{	
		var o = VT_getObjectByID(id + i);
		if ((o) && (o.checked)) 
		{
		
		if (s != "") { s = s + ",";}
			s = s + o.value;
		}
	}
	var target= VT_getObjectByID(target)
	if(target){
		target.value =s;
	}
	
}

function showChannels(sourceId,totalNo,targetId){
			
	var x = getCheckBoxs(sourceId,totalNo)
	var o = VT_getObjectByID(targetId);
	var t;
	t = x.split(",");
	var s ="";
	for(var i = 1; i < t.length; i = i +2){
		s = s + t[i] + '<br>';	
	}	
	
	if(o){
		o.innerHTML = s;
	}
}

function changeBackground(id,image){
	id.style.backgroundImage='url(' + image + ')'; 
}


function makeEditable(id){
  VT_getObjectByID(id).contentWindow.document.designMode='On';  
}
 
function doButton(id,aName, avalue,aArg){
  var o = VT_getObjectByID(id);
  if(o){
    VT_getIFrameDocument(id).execCommand(aName,avalue, aArg);
    o.contentWindow.focus();
  }
}

function viewSource(idIframe,targetID,idDiv){
	var o = VT_getObjectByID(idIframe);
	var x = VT_getObjectByID(idDiv);
	var element = VT_getObjectByID(targetID);
 
	if(o && x && element){
    	if(o.style.visibility=='visible'){
      		var content = VT_getIFrameDocument(idIframe).body.innerHTML;
      		o.style.visibility='hidden';
      		o.style.display='none';
      		x.style.visibility='visible';
      		x.style.display='';
      		element.value=content;
    	}
    	else{
      		VT_getIFrameDocument(idIframe).body.innerHTML = element.value;
      		x.style.visibility='hidden';
      		x.style.display='none';
      		o.style.visibility='visible';
      		o.style.display='';
    	}   
 	 }
}

function getDescription(idIframe,targetID){
	var o = VT_getObjectByID(idIframe);
	var element = VT_getObjectByID(targetID);
	if(o && element){
      var content = VT_getIFrameDocument(o).body.innerHTML;
      element.value=content;
    }
}

function updateSource(id,targetID,container){
  var o = VT_getObjectByID(id);
  if(o){
    VT_getIFrameDocument(o).body.innerHTML = VT_getObjectByID(targetID).value;
    var x = VT_getObjectByID(container);
    if(x){
      x.style.visibility='hidden';
      x.style.display='none';
      o.style.visibility='visible';
      o.style.display='';
      ;   
    }
  }
}

function VT_getIFrameDocument(element){
  // Mozilla
  if(VT_getObjectByID(element).contentDocument){
    return VT_getObjectByID(element).contentDocument;
  } else {  // IE
  	var o = VT_getObjectByID(element);    
  	return window.frames[o.name].document;
  }
} 


function formatText(id,tagstart,tagend){
  	if (VT_getObjectByID(id).setSelectionRange){
 		 if(VT_getObjectByID(id).value!=""){
      VT_getObjectByID(id).value = VT_getObjectByID(id).value.substring(0,VT_getObjectByID(id).selectionStart) + tagstart + VT_getObjectByID(id).value.substring(VT_getObjectByID(id).selectionStart,VT_getObjectByID(id).selectionEnd) + tagend + VT_getObjectByID(id).value.substring(VT_getObjectByID(id).selectionEnd,VT_getObjectByID(id).value.length)
  	 }
  	}
  	else {
  	var o = VT_getObjectByID(id);
  	//alert(id.contentDocument.body.innerHTML.selection.createRange().text);
  	 var selectedText = document.selection.createRange().text;
        if (selectedText != "") {
            var newText = tagstart + selectedText + tagend;
            document.selection.createRange().text = newText;
        } 
  	}
  }  
  
function getSelectedText()
{
    var txt = '';
     if (window.getSelection)
    {
        txt = window.getSelection();
        return txt;
             }
    else if (document.getSelection)
    {
        txt = document.getSelection();
        return txt;
            }
    else if (document.selection)
    {
        txt = document.selection.createRange().text;
        return txt;    }
    else return;
}

function getMonthName(month){
  switch (month)
  {
  case 0:
    return "January";
    break
  case 1:
    return "February";
    break
  case 2:
    return "March";
    break
  case 3:
    return "April";
    break
  case 4:
    return "May";
    break
  case 5:
    return "June";
    break
  case 6:
    return "July";
    break
  case 7:
    return "August";
    break
  case 8:
    return "September";
    break
  case 9:
    return "October";
    break
  case 10:
    return "November";
    break
  case 11:
    return "December";
    break
  }
}



function detectCapsLock(e){
	if( !e ) { e = window.event; } if( !e ) {document.getElementById('capsNotify').style.visibility = 'hidden'; }
	//what (case sensitive in good browsers) key was pressed
	var theKey = e.which ? e.which : ( e.keyCode ? e.keyCode : ( e.charCode ? e.charCode : 0 ) );
	//if backspace pressed remove notification
	if (theKey == 8) {document.getElementById('capsNotify').style.visibility = 'hidden'; }
	
	//was the shift key was pressed
	var theShift = e.shiftKey || ( e.modifiers && ( e.modifiers & 4 ) ); //bitWise AND
	//if upper case, check if shift is not pressed. if lower case, check if shift is pressed
	if ( ( theKey > 64 && theKey < 91 && !theShift ) || ( theKey > 96 && theKey < 123 && theShift ) ) {document.getElementById('capsNotify').style.visibility = 'visible';}
	else {document.getElementById('capsNotify').style.visibility = 'hidden';}

// kc = e.keyCode?e.keyCode:e.which;
// sk = e.shiftKey?e.shiftKey:((kc == 16)?true:false);
// if(((kc >= 65 && kc <= 90) && !sk)||((kc >= 97 && kc <= 122) && sk))
//  document.getElementById('capsNotify').style.visibility = 'visible';
// else
//  document.getElementById('capsNotify').style.visibility = 'hidden';
}


function showRate(thumbid,newrating,loggedin) {
showHideDropDown();
showDiv('commentblocker','commentSize');
if (loggedin=='true')
	{
	document.getElementById('commentid').value = thumbid;
	document.getElementById('addcomment').rating[newrating-1].checked = true;
	}
	//alert(document.getElementById('comments'+thumbid).innerHTML);
document.getElementById('thumbComments').innerHTML = document.getElementById('comments'+thumbid).innerHTML;
}

function showHideDropDown() {
	if (document.getElementById('sortTypeDrop') && openBoxes == 0)
		{
		if (document.getElementById('sortTypeDrop').style.visibility == 'hidden') {document.getElementById('sortTypeDrop').style.visibility = 'visible';}
		else {document.getElementById('sortTypeDrop').style.visibility = 'hidden'; }
		}
}

function showReportComment(commentid) {
var o = VT_getObjectByID('reportcommentblock');
o.style.display='block';
o.style.visibility='visible';
openBoxes++;
o.style.height=document.body.scrollHeight;
o.style.width=document.body.scrollWidth;
document.getElementById('reportcommentid').value = commentid;
document.getElementById('commenttext').innerHTML = document.getElementById('comment-'+commentid).innerHTML;
}

function captureReturnKey(func)
	{
		if (this.event)
			{
			var key=(this.event.charCode) ? this.event.charCode : ((this.event.keyCode) ? this.event.keyCode : (( this.event.which) ? this.event.which : 0 ));
			if(key=="13") { func(); }
			}
	}	
