<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2005-2006 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts EasyCreate 1.1                 |
// +----------------------------------------------------------------------+
// | Authors: sudheesh<sudheesh@armia.com>        		              	  |
// |          									                          |
// +----------------------------------------------------------------------+
  include "../includes/session.php";
  include "../includes/config.php";
  include "../includes/function.php";
  $currentloc="../";
  include "../includes/applicationheader.php";
?>
<script>
var used_space = 0; 
var quota = 10; 
var sUploadsList = new Array(); 

var hyper_mode = 1;

 onload = function(){
 	try{
	if(dialogArguments.url.length > 0)
	txtAnchor.value=dialogArguments.url;
	}
	catch(e){}
 }
 function sInsertLink(){
   	
	linkSource = 'http://' + txtAnchor.value.replace(/http:\/\//ig, '');
	if(linkSource) { 
	returnValue = new Object();
	if(linkSource.length > 0) {
   returnValue = new Object();
   returnValue.url = linkSource;
   }

   window.close();
  }else{
   alert("Enter an address for creating an anchor.");
   focus();
  }
 }

 function sDefault(){
  lsField.disabled = rsField.disabled = linkcolor.disabled = hovercolor.disabled = hypSelDecLink.disabled = hypSelDecHover.disabled = modifyStyle.checked;
  sChangeHoverState();
 }

 function sChangeHoverState(){
  rsField.disabled = hovercolor.disabled = hypSelDecHover.disabled = !sUseHover.checked;
 }
function sInsertLinkInernal(){
		linkSource = sLoc.options[sLoc.selectedIndex].value;
		
		if(linkSource) { 
			   returnValue = new Object();
				if(linkSource.length > 0) {
			   		returnValue = new Object();
			   		returnValue.url = linkSource;
			    }
	
	   			window.close();
	    }else{
			   alert("Link address cannot be left blank");
			   focus();
	    }
 }
</script>
<body>
<table width=260 cellspacing=0 cellpadding=0 border=0>
<tr><td height=15></td></tr>
<tr><td>&nbsp;</td>
</tr>
<tr><td>
 <fieldset><legend class=maintext><b>External Link</b></legend><div id=sTextLoc class=maintext>Enter link to the external resource <br>(eg. http://www.iscripts.com).</div><img src=../images/spacer.gif width=1 height=20><input class=textbox type=text size=40 id=txtAnchor>
 <br>&nbsp;<div align="center"><input class=button type=button id=hypOK value="&nbsp;&nbsp;&nbsp; OK &nbsp;&nbsp;&nbsp;" onclick="sInsertLink();"> <input class=button type=button value=Cancel onclick="javascript: window.close();"></div>

 </fieldset>
</td></tr>


<tr><td height=30>&nbsp;&nbsp;&nbsp;</td></tr>
<tr>
 <?php
 	if($_SESSION['session_edittype'] !="edit") {
 		$sql = "select vpage_name,vpage_type from tbl_tempsite_pages where ntempsite_id='" . $_SESSION["session_currenttempsiteid"] . "'";
	}
	else {
		$sql = "select vpage_name,vpage_type from tbl_site_pages where nsite_id='" . $_SESSION["session_siteid"] . "'";
	}
	
	
	?>
  <td height="60">
 <fieldset><legend class="maintext"><b>Local Page</b></legend><div class="maintext">Select one of the pages you have already created.</div><img src=../images/spacer.gif width=1 height=20>
 <select id=sLoc style=" width:240px; " class=selectbox><option> - Select a page - </option>
 
	<?php
	$result = mysql_query($sql) or die(mysql_error());
	if(mysql_num_rows($result) > 0) {
		while($row = mysql_fetch_array($result)) {
		     if(strcasecmp($row["vpage_type"],"guestbook")==0){
			   $row["vpage_name"]=strtolower($row["vpage_name"]).".php"   ;
			 }else{
			   $row["vpage_name"]=strtolower($row["vpage_name"]).".htm"   ;
			 }
			echo("<option value=\"" . $row["vpage_name"] . "\">" . $row["vpage_name"] . "</option>");
		}
	}
 ?>
 </select><br>&nbsp;<div align="center"><input type=button id=hypOK value="&nbsp;&nbsp;&nbsp; OK &nbsp;&nbsp;&nbsp;" onclick="sInsertLinkInernal();" class="button"> <input type=button value=Cancel onclick="javascript: window.close();"  class="button"></div></fieldset>
</td></tr>







</table>
<OBJECT id=dlgHelper CLASSID="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px"></OBJECT>
<?php
  include "./includes/editorfooter.php";
?>  