/*
 * Javascript Function
 * __________________________________________________________________
 *
 * Title:		pluszone Javascript Function
 * Description:		pluszone Javascript Function
 *
 * Website:	        pluszone.net
 * Last modified:	28th December 2003
 *
 * @author		zzun ( zzun@pluszone.net )
 */

function copyTrackBackUrl(url)
{
    window.clipboardData.setData("Text",url);
    alert("Copied into a clipboard");
}

function doCopy(s)
{
	var doc = document.body.createTextRange();
	doc.moveToElementText(document.all(s));
	doc.select();
	doc.execCommand('copy');
	alert("Copied into a clipboard");
}

function checkSource(limit)
{
	var thisForm = document.plusForm.source;
	var bytes = getSourceLength(thisForm.value);
	if (!isBlank(thisForm.value))
	{
		alert("source code not found!");
		thisForm.focus();
		return false;
	}
	if(bytes > limit)
	{ 
		alert("\nSorry,exceeded the source code length limit.\nLimit source code length:" + limit + "\nYour source code length:" + bytes + "\n");
		return false;
	}
	return true;
}

function isBlank(field)
{
	 if (field.search(/^\s*$/) != 0)
	 {
		 return true;
	 }
	 return false;
}

function getSourceLength(str)
{
	var i, j=0;
	for(i=0;i<str.length;i++)
	{
		var val=escape(str.charAt(i)).length;
		if(val== 6) j++;
		j++;
	}
	return j;
}