//^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
//											BOLD  -  UNDERLINE -  ITALIC  -  LINK 
//¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯
function bolded(btext){
	bdtext="<b>"+btext+"</b>";
	document.getElementById("adit").value+=bdtext;
	document.getElementById("tobold").value="";
}
function boldit(){
	document.getElementById("dispop").innerHTML="<div id=insidedit><a id='clos' href=javascript:closescreen() title='Close'>x</a><br><br><span>Bold</span><br><p class=request>Enter the text you want to bold<br><input id='tobold' type=text class=tebo maxsize=300 size=50></p><a href=javascript:bolded(document.getElementById('tobold').value)>Bold</a><br><br><br><p class=instruc>** The text you entered will automatically appear at the end of the textarea below.</p></div>";
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

function italed(itext){
	idtext="<i>"+itext+"</i>";
	document.getElementById("adit").value+=idtext;
	document.getElementById("toital").value="";
}
function italicit(){
	document.getElementById("dispop").innerHTML="<div id=insidedit><a id='clos' href=javascript:closescreen() title='Close'>x</a><br><br><span>Italics</span><br><p class=request>Enter the text you want in italics<br><input id='toital' type=text class=tebo maxsize=300 size=50></p><a href=javascript:italed(document.getElementById('toital').value)>Italicize</a><br><br><br><p class=instruc>** The text you entered will automatically appear at the end of the textarea below.</p></div>";
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

function undered(utext){
	udtext="<u>"+utext+"</u>";
	document.getElementById("adit").value+=udtext;
	document.getElementById("tounder").value="";
}
function underit(){
	document.getElementById("dispop").innerHTML="<div id=insidedit><a id='clos' href=javascript:closescreen() title='Close'>x</a><br><br><span>Underline</span><br><p class=request>Enter the text you want to underline<br><input id='tounder' type=text class=tebo maxsize=300 size=50></p><a href=javascript:undered(document.getElementById('tounder').value)>Underline</a><br><br><br><p class=instruc>** The text you entered will automatically appear at the end of the textarea below.</p></div>";
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/

function linkud(linkurl,linklab){
	if(linklab==null || linklab==""){
		linklab=linkurl;
	}
	if(linkurl!="" && linklab!=""){
		if(linkurl.match("http://")==null){
			linkurl="http://"+linkurl;
		}
		ldtext="<a href='"+linkurl+"'>"+linklab+"</a>"
		document.getElementById("adit").value+=ldtext;
	}
}
function linkit(){
	document.getElementById("dispop").innerHTML="<div id=insidedit><a id='clos' href=javascript:closescreen() title='Close'>x</a><br><br><span>Hyperlink</span><br><p class=request>Enter the URL you want to link to<input id='lurl' type=text class=tebo maxsize=300 size=50><br>Enter a label for your link<input id='llab' type=text class=tebo maxsize=300 size=50></p><a href=javascript:linkud(document.getElementById('lurl').value,document.getElementById('llab').value)>Link it!</a><p class=instruc>** Your link will automatically appear at the end of the textarea below.</p></div>";
}



//^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
//											@@@@@	E M B E D   M E D I A   @@@@@
//¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯


function embedit(){
	document.getElementById("dispop").innerHTML="<div id=insidedit><a id='clos' href=javascript:closescreen() title='Close'>x</a><br><br><span>Embed Media</span><div class=embedstruc>Paste your embed code in here</div><a href='javascript:void(0)' style='margin-top: 85px;'>Embed it!</a><div class=codearea><iframe  name='embd' id='embd' allowTransparency='true' scrolling='no' src='http://www.aarqee.com/scripts/p/dp/arqeditor.php?foru=2' frameborder=0></iframe></div><div class=emstruc>** A special embed code will be generated and placed at the end of the textarea below.</div></div>";
}

//^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
//										@@@@@	I M A G E   M A N A G E R   @@@@@
//¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯

function imageman(){//---------------------------------------memorises the contents of imgbox
	document.getElementById("dispop").innerHTML=imgbox;
}

function inmage(imana,userdirt,bloi){
	imana2=imana;
	userdirt2=userdirt;
	codde="&#60;img&#32;src=\'http://www.aarqee.com/"+userdirt+imana+"\'&#32;alt=\'"+imana+"\'&#32;title=\'"+imana+"'&#62;";
	if(imana.length>25){
		screentitl=imana.slice(0,22)+"...";
	}else{
		screentitl=imana;
	}

	if(bloi==1){
	//--------------------if image is blocked, change the thumbnail and poppy src
	//--------------------to 'image not allowed' image
		tsrc="a/imagenotallowed.png";
		imann="imagenotallowed.png";
	}else{
		tsrc=userdirt+imana;
		imann=imana2;
	}
	thumbn="<div id='imgnabx' title='"+imana+"'><b>"+screentitl+"</b></div><img id='thumby' src='http://www.aarqee.com/"+tsrc+"' onmouseover=tooltipbox(this.id) onmouseout=tooltipc() onclick=callpoppy(imann,userdirt2,"+bloi+")><a href=javascript:delimg(imana2,"+bloi+") id='delt' onmouseover=tooltipbox(this.id) onmouseout=tooltipc()><img src='http://www.aarqee.com/a/trash.png' alt='trash' title='Delete image'></a><div id='htmcd'>HTML code:&#32;&#32;<input id='imgcode' type=text class=tebo maxlength=300 value="+codde+"></div>";
	
	document.getElementById("screen").innerHTML=thumbn;
}
function delimg(imana,bloi){
	//---------------------pass a post variable to indicate blocked image
	if(bloi==1){
		bim="&bmg=1";
	}else{
		bim="";
	}
	document.getElementById('screen').innerHTML="<br><br><br><center>D E L E T I N G<br><img src='http://www.aarqee.com/a/loading.gif' alt='in progress' style='margin-top:80px;'></center>";
	window.frames['picmang'].document.getElementById("asst_picmang").src="http://www.aarqee.com/scripts/p/dp/arqeditor.php?foru=1&rmv=1"+bim+"&rfname="+imana;
	document.getElementById('piclister').removeChild(document.getElementById(imana));
}

function callpoppy(imana,userdirt,bloi){
	document.getElementById("poppy").style.width="100%";
	document.getElementById("poppy").style.height="100%";
	document.getElementById("poppy").style.visibility="visible";

	//---------------------display image not allowed if image is blocked
	if(bloi==1){
		srct="a/"+imana;
	}else{
		srct=userdirt+imana;
	}
					
	document.getElementById("poppy").innerHTML="<div style='border: 0px; width:100%; height:100%; position:absolute; background:#000000; opacity:0.45; filter:alpha(opacity=45);'></div><table height=100% width=100%; style='position:absolute;'><tr><td style='text-align:center;'><img src='http://www.aarqee.com/"+srct+"' style='cursor:hand;' onclick=closepoppy()><p style='color: #fff;'>Click on the image to close.</p></td></tr></table>";

	//-------------first, when poppy is opened, it takes the position of the top of the window that is gotten through
	//-------------'document.documentElement.scrollTop'.  Then when window is scrolled (window.onscroll), poppy's top
	//-------------value is assigned with 'document.documentElement.scrollTop'.  Real time.

	document.getElementById("poppy").style.top=document.documentElement.scrollTop+"px";
	window.onscroll=function(){
		document.getElementById("poppy").style.top=document.documentElement.scrollTop+"px";
	}
}

function closepoppy(){
	document.getElementById("poppy").innerHTML="";
	document.getElementById("poppy").style.visibility="hidden";
	//clearTimeout(loopy);
}

//^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^
//										@@@@@	F A N C Y  S T U F F   @@@@@
//¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯V¯

function unselect(imana){
	document.getElementById(imana).style.background="transparent";
}

function tooltipbox(mes){
	switch(mes){
		case "bol":
			parent.document.getElementById("helpbox").innerHTML="Bold your text.";
			break;
		case "ita":
			parent.document.getElementById("helpbox").innerHTML="Italicise your text.";
			break;
		case "und":
			parent.document.getElementById("helpbox").innerHTML="Underline your text.";
			break;
		case "lin":
			parent.document.getElementById("helpbox").innerHTML="Hyperlink your text.";
			break;
		case "mb":
			parent.document.getElementById("helpbox").innerHTML="Embed media with embed codes.";
			break;
		case "imge":
			parent.document.getElementById("helpbox").innerHTML="Get HTML codes for your images to use for your arq.";
			break;
		case "thumby":
			parent.document.getElementById("helpbox").innerHTML="Click thumbnail to view image in full size.";
			break;
		case "delt":
			parent.document.getElementById("helpbox").innerHTML="Delete image.";
			break;
	}
}

function tooltipc(){
	parent.document.getElementById("helpbox").innerHTML="Help Box";
}
function closescreen(){
	document.getElementById("dispop").innerHTML="<br><br><center><p class=labelcolor style='font-size: 14px;'>ARQ EDITOR</p><p style='font-size: 14px;'>You can use the Arq Editor to edit your text, insert hyperlinks, embed videos and manage images.  Choose your option from the control panel on the left.<br><br>For more information about the Arq Editor, click here.</p></center>";
}
function loadload(loadid){
	switch(loadid){
		case "imgup":
			parent.document.getElementById("screen").innerHTML="<br><br><br><center>U P L O A D I N G<br><img src='http://www.aarqee.com/a/loading.gif' alt='' style='margin-top:80px;'></center>";
			break;
		
	}
}