﻿
function validateArgumentDescription(sender, args)
{
	args.IsValid = args.Value.length >= 10;
}

function validateVideoUrl(sender, args)
{
	var re = new RegExp("http:\\/\\/(www\\.)?youtube.com\\/watch\\?v=[A-Za-z\\d_-]+");
	
	if (args.Value != "")
		args.IsValid = re.exec(args.Value) != null;
	else
		args.IsValid = false;
}

function switchContainers(isDisplayList)
{
	document.getElementById(tblArgumentsId).style.display = isDisplayList ? "" : "none";
	document.getElementById(tblAddAgrumentId).style.display = isDisplayList ? "none" : "";
}

function positionTD(container, td, posY) 
{
    container = document.getElementById(container)
    td = document.getElementById(td)
    
    posY = parseInt(posY, 10)

    window.setTimeout(function(){positionTDCB(container, td, posY)}, 1000)
}

function positionTDCB(container, td, posY) {
    //td.style.display = "";
    if (td.clientHeight + posY > container.clientHeight-100) {
        posY = container.clientHeight-100 - (td.clientHeight) ;
    }
    //window.setTimeout(function() { td.style.marginTop = posY + "px" }, 4000)
    td.style.position = "relative";
    td.style.top= posY + "px"
}
