function s_q(Str){
	Str.replace("'","");
	Str.replace('"',"");
	return Str;
}
function addvalue(Name, Value){
	change_value(Name, element_value(Name) + "." + Value);
}
function deletevalue(Name, Value){
	change_value(Name,  element_value(Name).replace("."+Value, ""));
}
function swap_image(Element, ImageURL){
	Element.src = ImageURL;
}
function change_image(name, NewImage){
	document.getElementById(name).src = NewImage;
}
var myimages = new Array();
function preloading(){
	for (x=0; x<preloading.arguments.length; x++){
		myimages[x] = new Image();
		myimages[x].src = 'http://www.letsteachkorea.com/images/nav'+preloading.arguments[x]+'_over.gif';
	}
}

/* MENU FUNCTIONS */
	preloading('1', '2', '3', '4');

	function menu_swap(TheId){
		window.clearTimeout(window.timeoutid);
		for (x = 1; x < 6; x++){
			$('#nimg-'+x).attr("src",'http://www.letsteachkorea.com/images/nav'+x+'.png');
		}
		$('#nimg-'+TheId).attr("src", 'http://www.letsteachkorea.com/images/nav'+TheId+'_over.png');
	}
	RevertTo = 1;
	function RevertMenuSwap(){
		window.timeoutid = setTimeout(function(){  menu_swap(RevertTo); }, 1500);
	}
function selectText(Element){
	Element.select();
}
function change_value(name, value){
	document.getElementById(name).value = value;
}
function change_title(name, value){
	document.getElementById(name).title = value;
}
function element_html(name, html){
	document.getElementById(name).innerHTML = html;
}
function inner_html(name){
	return document.getElementById(name).innerHTML;
}
function disable(name){
	document.getElementById(name).disabled=true;
}
function enable(name){
	document.getElementById(name).disabled=false;
}
function hide(Element){
	document.getElementById(Element).style.display = 'none';
}
function show(Element){
	document.getElementById(Element).style.display = 'block';
}
function element_display(name, display){
	 document.getElementById(name).style.display = display;
}
function element_value(name){
	return document.getElementById(name).value;
}
function element_ok(name, message){
	document.getElementById(name).innerHTML = '<font class="orange">'+message+'</font>';
}
function element_bad(name, message){
	document.getElementById(name).innerHTML = '<font class="red">'+message+'</font>';
}
function throbber_on(name){
	show(name);
	element_html(name, '<img src="<?=_libase_?>throbber.gif">');
}
function throbber_message(name, message){
	show(name);
	element_html(name, '<img src="<?=_libase_?>throbber.gif" align="left">&nbsp;&nbsp;&nbsp;'+message);
}
function setfocus(name){
	document.getElementById(name).focus();
}
function throbber_off(name){
	var innerhtml = document.getElementById(name).innerHTML;
	innerhtml = innerhtml.replace('<img src="<?=_libase_?>throbber.gif">', "");
	element_html(name, innerhtml);
}
function loop_force_showhide(s_prefix,show,h_prefix,hide){	for (x = 0; x < show.length; x++)	{		forceshow(s_prefix+show[x]);	}	for (x = 0; x < hide.length; x++)	{		forcehide(h_prefix+hide[x]);	}}function loop_showhide(prefix,array){	for (x = 0; x < array.length; x++)	{		showhide(prefix+array[x]);	}}function loop_show(prefix,array){	for (x = 0; x < array.length; x++)	{		forceshow(prefix+array[x]);	}}function loop_hide(prefix,array){	for (x = 0; x < array.length; x++)	{		forcehide(prefix+array[x]);	}}function showhide(ElementName){	ElementId = document.getElementById(ElementName);     if (ElementId.style.display == 'none')     {          ElementId.style.display = 'block';     }     else     {          ElementId.style.display = 'none';     }}function forceshow(ElementName){	ElementId = document.getElementById(ElementName);	ElementId.style.display = 'block';}function forcehide(ElementName){	ElementId = document.getElementById(ElementName);	ElementId.style.display = 'none';}
function loop_setstyle(style, s_prefix, array){	for (x = 0; x < array.length; x++)	{		force_style(style, s_prefix+array[x]);	}}function force_style(style, ElementName){	ElementId = document.getElementById(ElementName);	ElementId.className=style;}
function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit){
		field.value = field.value.substring(0, maxlimit);
	} else {
		countfield.value = maxlimit - field.value.length;
	}
}
function ValidateMediaType(Element){
	var name = Element.value;
	var name = name.toLowerCase();

	var temp = new Array();
	temp = name.split('.');
	var type = temp[temp.length-1];
	if(	(type != "wmv") && (type != "mpeg") && (type != "mpg") && (type != "avi") && (type != "divx") && (type != "mp4") && (type != "flv") && (type != "asf")  && (type != "mov")  && (type != "rm")){
		alert('"' +type + '" Is an incorrect File Type');
		Element.value = "";
	}
}
function CleanComment(comment) {
	var reg = new RegExp("<([^<>\s]*)(\s[^<>]*)?>", "g");
    return comment.replace(reg,"");
}
function donothing(){}
function ResizeIt(offset){
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winH = window.innerHeight;
	}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winH = document.body.offsetHeight;
		}
	}
	document.getElementById('iframe').style.height = (winH - offset)+'px';
}
function ValidateUrl(Url) {
    var v = new RegExp();
    v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
    if (!v.test(Url)) {
        return true;
    } else {
    	return false;
    }
}

function popconfirm(message)
{
	var agree=confirm(message);
	if (agree){
		return true ;
	} else {
		return false ;
	}
}
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 sendReport(m, b, u){
	parent.frames['hiframe'].location="<?=_base_?>modules/report/process.php?m="+m+"&b="+b+"&u="+u;
}
function ShareThis(social_site, url, title, content){

	if (url != ''){

		if(social_site == 'delicious'){
			var url = 'http://del.icio.us/post?v=4&noui&jump=close&url=' + url + '&title=' + title;

		} else if (social_site == 'digg'){
			var url = 'http://digg.com/submit?phase=2&url=' + url + '&title=' + title + '&bodytext=' + content;

		} else if (social_site == 'dropjack'){
			var url = 'http://www.dropjack.com/submit.php?url=http://redirect.alexa.com/redirect?' + url + '&title=' + title;

		} else if (social_site == 'sphinn'){
			var url = 'http://sphinn.com/login.php?return=/submit.php?url=http://redirect.alexa.com/redirect?' + url + '&title=' + title;

		} else if (social_site == 'furl'){
			var url = 'http://furl.net/storeIt.jsp?u=http://redirect.alexa.com/redirect?' + url + '&t=' + title;

		} else if (social_site == 'netscape'){
			var url = 'http://www.netscape.com/submit/?U=http://redirect.alexa.com/redirect?' + url + '&T=' + title;

		} else if (social_site == 'yahoo'){
			var url = 'http://myweb2.search.yahoo.com/myresults/bookmarklet?u=' + url + '&t=' + title + '&ei=UTF-8';

		} else if (social_site == 'stumbleupon'){
			var url = 'http://www.stumbleupon.com/submit?url=' + url + '&title=' + title;

		} else if (social_site == 'google_bmarks'){
			var url = 'http://www.google.com/bookmarks/mark?op=edit&bkmk=http://redirect.alexa.com/redirect?' + url + '&title=' + title;

		} else if (social_site == 'technorati'){
			var url = 'http://www.technorati.com/faves?add=http://redirect.alexa.com/redirect??' + url;

		} else if (social_site == 'blinklist'){
			var url = 'http://blinklist.com/index.php?Action=Blink/addblink.php&Url=http://redirect.alexa.com/redirect?' + url + '&Title=' + title;

		} else if (social_site == 'newsvine'){
			var url = 'http://www.newsvine.com/_wine/save?u=http://redirect.alexa.com/redirect?' + url + '&h=' + title;

		} else if (social_site == 'magnolia'){
			var url = 'http://ma.gnolia.com/bookmarklet/add?url=http://redirect.alexa.com/redirect?' + url + '&title=' + title;

		} else if (social_site == 'reddit'){
			var url = 'http://reddit.com/submit?url=' + url + '&title=' + title;

		} else if (social_site == 'windows_live'){
			var url = 'https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=http://redirect.alexa.com/redirect?' + url + '&title=' + title + '&top=1';

		} else if (social_site == 'tailrank'){
			var url = 'http://tailrank.com/share/?link_href=http://redirect.alexa.com/redirect?' + url + '&title=' + title;

		} else if (social_site == 'facebook'){
			var url = 'http://www.facebook.com/sharer.php?u=' + url + '&t=' + title;

		}

		window.open(url, 'ShareThis');

	}
}