<?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>                                    |
// |                                                                                                            |
// +----------------------------------------------------------------------+

/* before entering this page all the session variable will be set by calling the function SaveSitePreview()
*  furthor procedure is same as in getsitedetail.php
*/

include "includes/session.php";
include "includes/config.php";
include "includes/function.php";
$tmpsiteid=$_SESSION['session_currenttempsiteid'];
$templateid=$_SESSION['session_currenttemplateid'];
$userid=$_SESSION["session_userid"];
$siteid=$_SESSION['session_siteid'];

if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
if($_POST['btnback']=="Back"){
   header("location:editsitepageoption.php");
   exit;
}
/*assumes that logo,caption,company etc  are
tp_logoimage.jpg->logo image,tp_innerlogoimage.jpg->inner logoimage,tp_logoband.jpg->logoband
tp_innerlogoband.jpg->inner logo band,tp_company.jpg->company,tp_innercompany.jpg->inner company
tp_companyband.jpg->company band,tp_innercompanyband.jpg->inner company band,tp_caption.jpg->caption
tp_innercaption.jpg->inner caption,tp_captionband.jpg->caption band,tp_innercaptionband.jpg->inner caption band
*/
$tp_logo="tp_logoimage.jpg";
$tp_innerlogo="tp_innerlogoimage.jpg";
$tp_logoband="tp_logoband.jpg";
$tp_innerlogoband="tp_innerlogoband.jpg";
$tp_company="tp_company.jpg";
$tp_innercompany="tp_innercompany.jpg";
$tp_companyband="tp_companyband.jpg";
$tp_innercompanyband="tp_innercompanyband.jpg";
$tp_caption="tp_captionband.jpg";
$tp_innnercaption="tp_innercaptionband.jpg";
$tp_captionband="tp_captionband.jpg";
$tp_innercaptionband="tp_captionband.jpg";
if($_SESSION['session_published']=="yes"){
                     $urllocation="./workarea/sites/$siteid/images/";
                         if(!is_dir($urllocation)){
                             echo "Sites removed.Please contact the administartor to resolve the issue";
                         }

}else{
                     $urllocation="./workarea/tempsites/$tmpsiteid/images/";
                         if(!is_dir($urllocation)){
                             echo "Sites removed.Please contact the administartor to resolve the issue";
                         }
 }

if($_POST['btnsave']=="Save"){
       //check logouploaded
            if(!validateSizePerUser($_SESSION["session_userid"],$size_per_user,$allowed_space)) {
           $errormessage = "The space taken by you has exceeded the allowed limit.<br>(Space taken by you: " . human_read($size_per_user) . " <br>Allowed space: " . human_read($allowed_space) . ")<br>Delete
                   unused images or any/all of the sites created by you to proceed further.<br>&nbsp;<br>";
                }else{
              $errormessage="";
                   if($_POST['logooption']=="N"){


                                $logobandname=$tp_logoband;
                            $actuallogbandloc="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$logobandname;
                            $assignedname=$logobandname;
                            $_SESSION['session_logobandname']=$assignedname;
                            copy($actuallogbandloc,$urllocation.$assignedname);
                            chmod($urllocation.$assignedname,0777);
                            if($_SESSION['session_published']!="yes")
                                                                  watermarkimage($urllocation.$assignedname);
                           //make logoband for innerpages
                           $logobandname=$tp_innerlogo;
                           $assignedname_innerlogo=$logobandname;
                       $_SESSION['session_innerlogobandname']=$assignedname_innerlogo;
                       $actuallogbandloc="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$logobandname;
                           copy($actuallogbandloc,$urllocation.$assignedname_innerlogo);
                       chmod($urllocation.$assignedname_innerlogo,0777);
                           if($_SESSION['session_published']!="yes")
                                 watermarkimage($urllocation.$assignedname_innerlogo);



                }else  if($_FILES['filelogo']['size'] <=0 and $_SESSION['logoname']==""){
                         //if logo not uploaded or not selected from our gallery

                                           $logobandname=$tp_logo;
                                                           $actuallogbandloc="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$logobandname;
                                               $assignedname=$logobandname;
                                                               $_SESSION['session_logobandname']=$assignedname;
                                                               copy($actuallogbandloc,$urllocation.$assignedname);
                                                               chmod($urllocation.$assignedname,0777);
                                                                   if($_SESSION['session_published'] !="yes"){
                                                                   if($_SESSION['session_published']!="yes")
                                                                  watermarkimage($urllocation.$assignedname);
                                                                   }

                                                                   //make logoband for innerpages
                                                                   $logobandname=$tp_innerlogo;
                                                                   $assignedname_innerlogo=$logobandname;
                                                               $_SESSION['session_innerlogobandname']=$assignedname_innerlogo;
                                                               $actuallogbandloc="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$logobandname;
                                                                   copy($actuallogbandloc,$urllocation.$assignedname_innerlogo);
                                                               chmod($urllocation.$assignedname_innerlogo,0777);
                                                                   if($_SESSION['session_published']!="yes")
                                                                         watermarkimage($urllocation.$assignedname_innerlogo);



                  }else{

                                      $errormessagefileupload="";
                                      if($_FILES['filelogo']['size'] >0){
                                                                list($width, $height, $type, $attr) = @getimagesize($_FILES['filelogo']['tmp_name']);
                                                                if($type>3){
                                                                            $errormessagefileupload="Please upload only .jpg,.gif,.png image types";
                                                                        }else{
                                                                        $imagewidth_height_type_array=explode(":",ImageType( $_FILES['filelogo']['tmp_name']));
                                                                                $imagetype=$imagewidth_height_type_array[0];
                                                                                $assignedname="ug_".$userid."_logo".time().".".$imagetype;
                                                                                $_SESSION['logoname']=$assignedname;
                                                                                move_uploaded_file($_FILES['filelogo']['tmp_name'],"./usergallery/$userid/images/".$assignedname);
                                                                                chmod("./usergallery/$userid/images/".$assignedname,0777);
                                                                                copy("./usergallery/$userid/images/".$assignedname,$urllocation.$assignedname);
                                                                                chmod($urllocation.$assignedname,0777);
                                                                                if($_SESSION['session_published']!="yes")
                                                                                                watermarkimage($urllocation.$assignedname);
                                                                   }
                                                                }
                                                                if($errormessagefileupload==""){
                                                                                                                   $logobandname=$tp_logoband;
                                                                                                               $actuallogbandloc="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$logobandname;
                                                                                                                   $imagewidth_height_type_array=explode(":",ImageType($actuallogbandloc));
                                                                                                                   $imagetype=$imagewidth_height_type_array[0];
                                                                                                                   $imagewidth=$imagewidth_height_type_array[1];
                                                                                                                   $imageheight=$imagewidth_height_type_array[2];
                                                                                                                   //$assignedname="ug_logoband_t".$tmpsiteid.".jpg";
                                                                                                                    if($_SESSION['session_edittype']=="edit"){
                                                                                                                             $assignedname="ug_logoband_s".$siteid.".jpg";
                                                                                                                         }else{
                                                                                                                               $assignedname="ug_logoband_t".$tmpsiteid.".jpg";
                                                                                                                         }
                                                                                                                          if($_SESSION['session_edittype']=="edit"){
                                                                                                                                     //$assignedname="ug_logoband_s".$siteid.".jpg";
                                                                                                                                         $assignedname_innerlogo="ug_innerlogoband_s".$siteid.".jpg";
                                                                                                                         }else{
                                                                                                                                      $assignedname_innerlogo="ug_innerlogoband_t".$tmpsiteid.".jpg";
                                                                                                                         }
                                                                                                                  // $assignedname_innerlogo="ug_innerlogoband_t".$tmpsiteid.".jpg";
                                                                                                                   $_SESSION['session_logobandname']=$assignedname;

                                                                                                                   copy($actuallogbandloc,$urllocation.$assignedname);
                                                                                                                   chmod($urllocation.$assignedname,0777);
                                                                                                                   if( is_file("./usergallery/$userid/images/".$_SESSION['logoname']) ){
                                                                                                                        $image2="./usergallery/$userid/images/".$_SESSION['logoname'];
                                                                                                                                copy($image2,"./usergallery/$userid/images/".$assignedname_innerlogo);
                                                                                                                   }elseif(is_file("./samplelogos/".$_SESSION['logoname'])){
                                                                                                                        $image2="./samplelogos/".$_SESSION['logoname'];
                                                                                                                                copy($image2,"./usergallery/$userid/images/".$assignedname_innerlogo);
                                                                                                                   }


                                                                                                                   $resizedimage=$urllocation."rez_".$assignedname;

                                                                                                                   Resizeimage($image2,$imageheight,$imagewidth,$resizedimage);
                                                                                                                   chmod($resizedimage,0777);
                                                                                                                   embedimage($urllocation.$assignedname,$resizedimage);
                                                                                                                   unlink($resizedimage);

                                                                                                                   copy($urllocation.$assignedname,"./usergallery/$userid/images/".$assignedname);

                                                                                                                   chmod("./usergallery/$userid/images/".$assignedname,0777);
                                                                                                                   chmod($urllocation.$assignedname,0777);
                                                                                                                   if($_SESSION['session_published']!="yes")
                                                                                                                                           watermarkimage($urllocation.$assignedname);

                                                                                                                   //make logoband for innerpages
                                                                                                                   $logobandname=$tp_innerlogoband;
                                                                                                               $actuallogbandlocinnerlogo="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$logobandname;
                                                                                                                   $imagewidth_height_type_array=explode(":",ImageType($actuallogbandlocinnerlogo));
                                                                                                                   $imagetype=$imagewidth_height_type_array[0];
                                                                                                                   $imagewidth=$imagewidth_height_type_array[1];
                                                                                                                   $imageheight=$imagewidth_height_type_array[2];


                                                                                                                   $_SESSION['session_innerlogobandname']=$assignedname_innerlogo;
                                                                                                                   copy($actuallogbandlocinnerlogo,$urllocation.$assignedname_innerlogo);
                                                                                                                   chmod($urllocation.$assignedname_innerlogo,0777);
                                                                                                                   if( is_file("./usergallery/$userid/images/".$assignedname_innerlogo) ){
                                                                                                                        $image2="./usergallery/$userid/images/".$assignedname_innerlogo;
                                                                                                                   }elseif(is_file("./samplelogos/".$_SESSION['logoname'])){
                                                                                                                        $image2="./samplelogos/".$_SESSION['logoname'];
                                                                                                                   }
                                                                                                                   $resizedimage=$urllocation."rezinner_".$assignedname_innerlogo;
                                                                                                               Resizeimage($image2,$imageheight,$imagewidth,$resizedimage);
                                                                                                                   chmod($resizedimage,0777);
                                                                                                                   embedimage($urllocation.$assignedname_innerlogo,$resizedimage);
                                                                                                                   unlink($resizedimage);
                                                                                                                   if(is_file("./usergallery/$userid/images/".$assignedname_innerlogo)){
                                                                                                                     unlink("./usergallery/$userid/images/".$assignedname_innerlogo);
                                                                                                                   }
                                                                                                                   copy($urllocation.$assignedname_innerlogo,"./usergallery/$userid/images/".$assignedname_innerlogo);
                                                                                                                   chmod("./usergallery/$userid/images/".$assignedname_innerlogo,0777);
                                                                                                                   chmod($urllocation.$assignedname_innerlogo,0777);
                                                                                                                   if($_SESSION['session_published']!="yes")
                                                                                                                                           watermarkimage($urllocation.$assignedname_innerlogo);
                                                                                                                   //unlink("./usergallery/$userid/images/".$_SESSION['logoname']);
                                                                     }





                  }
                  if(trim($_POST['companyname'])=="" and $_SESSION['session_companybandname'] ==""){
                    //company is empty

                                           $companybandname=$tp_company;
                                           $actualcompbandloc="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$companybandname;
                                                           $imagewidth_height_type_array=explode(":",ImageType( $actuallogbandloc));
                                                           $imagetype=$imagewidth_height_type_array[0];
                                                           $assignedname=$companybandname;
                                                           $_SESSION['session_companybandname']=$assignedname;
                                                           copy($actualcompbandloc,$urllocation.$assignedname);
                                                           chmod($urllocation.$assignedname,0777);
                                                           if($_SESSION['session_published']!="yes")
                                                                                   watermarkimage($urllocation.$assignedname);

                                                           //make innerpage company
                                                           $companybandname=$tp_innercompany;
                                           $actualcompbandloc_inner="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$companybandname;
                                                           $assignedname_inner=$companybandname;
                                                           $_SESSION['session_innercompanybandname']=$assignedname_inner;

                                                           copy($actualcompbandloc_inner,$urllocation.$assignedname_inner);
                                                           chmod($urllocation.$assignedname_inner,0777);
                                                           if($_SESSION['session_published']!="yes")
                                                                                   watermarkimage($urllocation.$assignedname_inner);

                  }else if(trim($_POST['companyname'])!=""){
                        /*company details*/


                                                  if(get_magic_quotes_gpc()==1){
                                                               $companyname=stripslashes( $_POST['companyname']);
                                                          }else{
                                                                $companyname=$_POST['companyname'];
                                                          }

                                                           $selectedfont=addslashes(trim($_POST['compfont']));
                                                           $_SESSION['session_comselfontclr']=$_POST['fntclr'];
                                                           $fontcolor=addslashes(trim(substr($_POST['fntclr'],1 )));
                                                           $fontsize=addslashes(trim($_POST['fontsize']));

                                                           $_SESSION['session_comselfont']=$selectedfont;

                                                           $_SESSION['session_comselfontsize']=$fontsize;
                                                           $_SESSION['session_comseltext']=$companyname;

                                                           $companybandname=$tp_companyband;
                                                           $actualcompbandloc="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$companybandname;
                                                           $imagewidth_height_type_array=explode(":",ImageType( $actualcompbandloc));
                                                           $imagetype=$imagewidth_height_type_array[0];
                                                            if($_SESSION['session_edittype']=="edit"){
                                                                      $assignedname="ug_companyband_s".$siteid.".jpg";

                                                                 }else{
                                                                       $assignedname="ug_companyband_t".$tmpsiteid.".jpg";
                                                                 }

                                                           $_SESSION['session_companybandname']=$assignedname;

                                                           copy($actualcompbandloc,$urllocation.$assignedname);
                                                           chmod($urllocation.$assignedname,0777);
                                                           $image = NewimageCreatefromtype($urllocation.$assignedname);
                                                           $font="./fonts/".$selectedfont;

                                                           //$hexcolor = str_split($fontcolor, 2);
                                                                $hexcolor[0]=substr($fontcolor,0,2);
                                                                $hexcolor[1]=substr($fontcolor,2,2);
                                                                $hexcolor[2]=substr($fontcolor,4,2);
                                                                // Convert HEX values to DECIMAL
                                                                $bincolor[0] = hexdec("0x{$hexcolor[0]}");
                                                                $bincolor[1] = hexdec("0x{$hexcolor[1]}");
                                                                $bincolor[2] = hexdec("0x{$hexcolor[2]}");
                                                                $textcolor = ImageColorAllocate($image, $bincolor[0], $bincolor[1], $bincolor[2]);

                                                                $angle=0;
                                                                $xcordinate=10;
                                                                $ycordinate=20;
                                                                if(trim($companyname)==""){
                                                                   $companyname="Your Company";
                                                                 }
                                                          /* $checkmaximumlengthaloowed=imagettfbbox ( $fontsize,0, "./fonts/".$selectedfont, $companyname);
                                                           $imageallowablwidth=$checkmaximumlengthaloowed[2]-$checkmaximumlengthaloowed[0];
                                                           $imageallowablheight=$checkmaximumlengthaloowed[1]-$checkmaximumlengthaloowed[7];
                                                           $innerimagewidth=$imagewidth_height_type_array[1];
                                                           $innerimageheight=$imagewidth_height_type_array[2];

                                                           if($imageallowablwidth<$innerimagewidth and $imageallowablheight<$innerimageheight){
                                                              ;
                                                           }else{
                                                              $i=1;
                                                              while($i<100){
                                                                    $fontsize=$fontsize-1;
                                                                    $checkmaximumlengthaloowed=imagettfbbox ( $fontsize,0, "./fonts/".$selectedfont, $companyname);
                                                                        $imageallowablwidth=$checkmaximumlengthaloowed[2]-$checkmaximumlengthaloowed[0];
                                                                $imageallowablheight=$checkmaximumlengthaloowed[1]-$checkmaximumlengthaloowed[7];
                                                                        if($imageallowablwidth<$innerimagewidth and $imageallowablheight<$innerimageheight){
                                                                  break;
                                                                }
                                                                    $i++;
                                                                  }

                                                           }
                                                            $fontsize=$fontsize-($fontsize/3);*/
                                                                $xcordinate=10;
                                                            $ycordinate=$imagewidth_height_type_array[2]/2;
                                                                $ycordinate=$ycordinate+5;
                                                                imagettftext($image, $fontsize,$angle, $xcordinate, $ycordinate, $textcolor, $font, $companyname);
                                                                $newfile = $urllocation.$assignedname;
                                                                NewImagetype($image,$newfile,$urllocation.$assignedname);
                                                                copy($newfile,"./usergallery/$userid/images/".$assignedname);
                                                                chmod("./usergallery/$userid/images/".$assignedname,0777);
                                                                chmod($newfile,0777);
                                                                if($_SESSION['session_published']!="yes")
                                                                                watermarkimage($newfile);


                                                //make innercompany band
                                                       $companybandname=$tp_innercompanyband;
                                                       $actualcompbandloc_inner="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$companybandname;
                                                           $imagewidth_height_type_array=explode(":",ImageType( $actualcompbandloc_inner));
                                                           $imagetype=$imagewidth_height_type_array[0];
                                                            if($_SESSION['session_edittype']=="edit"){
                                                                     $assignedname="ug_innercompanyband_s".$siteid.".jpg";

                                                            }else{

                                                                           $assignedname="ug_innercompanyband_t".$tmpsiteid.".jpg";
                                                                }
                                                           //$assignedname="ug_innercompanyband_t".$tmpsiteid.".jpg";
                                                           $_SESSION['session_innercompanybandname']=$assignedname;

                                                           copy($actualcompbandloc_inner,$urllocation.$assignedname);
                                                           chmod($urllocation.$assignedname,0777);
                                                           $image = NewimageCreatefromtype($urllocation.$assignedname);
                                                           /*$checkmaximumlengthaloowed=imagettfbbox ( $fontsize,0, "./fonts/".$selectedfont, $companyname);
                                                           $imageallowablwidth=$checkmaximumlengthaloowed[2]-$checkmaximumlengthaloowed[0];
                                                           $imageallowablheight=$checkmaximumlengthaloowed[1]-$checkmaximumlengthaloowed[7];
                                                           $innerimagewidth=$imagewidth_height_type_array[1];
                                                           $innerimageheight=$imagewidth_height_type_array[2];

                                                           if($imageallowablwidth<$innerimagewidth and $imageallowablheight<$innerimageheight){
                                                              ;
                                                           }else{
                                                              $i=1;
                                                              while($i<100){
                                                                    $fontsize=$fontsize-1;
                                                                    $checkmaximumlengthaloowed=imagettfbbox ( $fontsize,0, "./fonts/".$selectedfont, $companyname);
                                                                        $imageallowablwidth=$checkmaximumlengthaloowed[2]-$checkmaximumlengthaloowed[0];
                                                                $imageallowablheight=$checkmaximumlengthaloowed[1]-$checkmaximumlengthaloowed[7];
                                                                        if($imageallowablwidth<$innerimagewidth and $imageallowablheight<$innerimageheight){
                                                                  break;
                                                                }
                                                                    $i++;
                                                                  }

                                                           }
                                                           $fontsize=$fontsize-($fontsize/3);*/
                                                           $fontsize=$fontsize-2;
                                                           $xcordinate=10;
                                                           $ycordinate=$imagewidth_height_type_array[2]/2;
                                                          $ycordinate=$ycordinate+5;
                                                                imagettftext($image, $fontsize,$angle, $xcordinate, $ycordinate, $textcolor, $font, $companyname);
                                                                $newfile = $urllocation.$assignedname;
                                                                NewImagetype($image,$newfile,$urllocation.$assignedname);
                                                                copy($newfile,"./usergallery/$userid/images/".$assignedname);
                                                                chmod("./usergallery/$userid/images/".$assignedname,0777);
                                                                chmod($newfile,0777);
                                                                if($_SESSION['session_published']!="yes")
                                                                                watermarkimage($newfile);


                  }

                  $_SESSION['session_sitecolor']=$_POST['stclr'];
                  if(trim($_POST['captionname'])=="" and $_SESSION['session_captionbandname'] ==""){
                        //if caption not enterted

                                                           $captionbandname=$tp_caption;
                                                           $actualcaptionbandloc="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$captionbandname;
                                                           $imagewidth_height_type_array=explode(":",ImageType( $actualcaptionbandloc));
                                                           $imagetype=$imagewidth_height_type_array[0];
                                                           $assignedname=$captionbandname;
                                                           $_SESSION['session_captionbandname']=$assignedname;
                                                           copy($actualcaptionbandloc,$urllocation.$assignedname);
                                                           chmod($urllocation.$assignedname,0777);
                                                           if($_SESSION['session_published']!="yes")
                                                                                   watermarkimage($urllocation.$assignedname);
                                                           //make inner caption band
                                                           $captionbandname=$tp_innnercaption;
                                                           $actualcaptionbandloc="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$captionbandname;
                                                           $assignedname=$captionbandname;
                                                           $_SESSION['session_innercaptionbandname']=$assignedname;

                                                           copy($actualcaptionbandloc,$urllocation.$assignedname);
                                                           chmod($urllocation.$assignedname,0777);
                                                           if($_SESSION['session_published']!="yes")
                                                                                   watermarkimage($urllocation.$assignedname);

                  }else if(trim($_POST['captionname'])!=""){
                        /*setthecaption*/
                                              if(get_magic_quotes_gpc()==1){
                                                                $captionname=stripslashes($_POST['captionname']);
                                                          }else{
                                                                $captionname=$_POST['captionname'];
                                                          }
                                                       //$captionname=addslashes(trim($_POST['captionname']));;
                                                           $selectedcaptionfont=addslashes(trim($_POST['captionfont']));
                                                           $_SESSION['session_capselfontclr']=$_POST['captfntclr'];
                                                           $captionfontcolor=addslashes(trim(substr($_POST['captfntclr'],1 )));;
                                                           $captionfontsize=addslashes(trim($_POST['captionfontsize']));
                                                           $captionbandname=$tp_captionband;

                                                           $_SESSION['session_capselfont']=$selectedcaptionfont;
                                                           $_SESSION['session_capselfontsize']=$captionfontsize;
                                                           $_SESSION['session_capseltext']=$captionname;


                                                           $actualcaptionbandloc="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$captionbandname;
                                                           $imagewidth_height_type_array=explode(":",ImageType( $actualcaptionbandloc));
                                                           $imagetype=$imagewidth_height_type_array[0];
                                                            if($_SESSION['session_edittype']=="edit"){

                                                                          $assignedname="ug_caption_s".$siteid.".jpg";;
                                                                 }else{
                                                                      $assignedname="ug_caption_t".$tmpsiteid.".jpg";;
                                                                 }

                                                           $_SESSION['session_captionbandname']=$assignedname;

                                                           copy($actualcaptionbandloc,$urllocation.$assignedname);
                                                           chmod($urllocation.$assignedname,0777);
                                                           $image = NewimageCreatefromtype($urllocation.$assignedname);
                                                           $font="./fonts/".$selectedcaptionfont;

                                                           //$hexcolor = str_split($fontcolor, 2);
                                                                $hexcolor[0]=substr($captionfontcolor,0,2);
                                                                $hexcolor[1]=substr($captionfontcolor,2,2);
                                                                $hexcolor[2]=substr($captionfontcolor,4,2);
                                                                // Convert HEX values to DECIMAL
                                                                $bincolor[0] = hexdec("0x{$hexcolor[0]}");
                                                                $bincolor[1] = hexdec("0x{$hexcolor[1]}");
                                                                $bincolor[2] = hexdec("0x{$hexcolor[2]}");
                                                                $textcolor = ImageColorAllocate($image, $bincolor[0], $bincolor[1], $bincolor[2]);

                                                                $angle=0;
                                                                $xcordinate=10;
                                                                $ycordinate=20;
                                                                if(trim($captionname)==""){
                                                                   $captionname="Your Caption";
                                                                 }

                                                           /*check whether the text can be append in image.Otherwise chaneg the font size
                                                                                   $checkmaximumlengthaloowed=imagettfbbox ( $captionfontsize,0, "./fonts/".$selectedcaptionfont, $captionname);
                                                                                   $imageallowablwidth=$checkmaximumlengthaloowed[2]-$checkmaximumlengthaloowed[0];
                                                                                   $imageallowablheight=$checkmaximumlengthaloowed[1]-$checkmaximumlengthaloowed[7];
                                                                                   $innerimagewidth=$imagewidth_height_type_array[1];
                                                                                   $innerimageheight=$imagewidth_height_type_array[2];

                                                                                   if($imageallowablwidth<$innerimagewidth and $imageallowablheight<$innerimageheight){
                                                                                      ;
                                                                                   }else{
                                                                                      $i=1;
                                                                                      while($i<100){
                                                                                            $captionfontsize=$captionfontsize-1;
                                                                                            $checkmaximumlengthaloowed=imagettfbbox ( $fontsize,0, "./fonts/".$selectedfont, $companyname);
                                                                                                $imageallowablwidth=$checkmaximumlengthaloowed[2]-$checkmaximumlengthaloowed[0];
                                                                                        $imageallowablheight=$checkmaximumlengthaloowed[1]-$checkmaximumlengthaloowed[7];
                                                                                                if($imageallowablwidth<$innerimagewidth and $imageallowablheight<$innerimageheight){
                                                                                          break;
                                                                                        }
                                                                                            $i++;
                                                                                          }

                                                                                   }
                                                                                   $captionfontsize=$captionfontsize-($captionfontsize/3);*/
                                                                                   $xcordinate=10;
                                                                                   $ycordinate=$imagewidth_height_type_array[2]/2;
                                                                                   $ycordinate=$ycordinate+5;
                                                                /*checking ends here*/
                                                                  imagettftext($image, $captionfontsize,$angle, $xcordinate, $ycordinate, $textcolor, $font, $captionname);
                                                                $newfile = $urllocation.$assignedname;
                                                                NewImagetype($image,$newfile,$urllocation.$assignedname);
                                                                copy($newfile,"./usergallery/$userid/images/".$assignedname);
                                                                chmod("./usergallery/$userid/images/".$assignedname,0777);
                                                                chmod($newfile,0777);
                                                                if($_SESSION['session_published']!="yes")
                                                                                watermarkimage($newfile);

                                                                 //make the inner caption band
                                                                           $captionbandname=$tp_innercaptionband;
                                                                               $actualcaptionbandloc_inner="./".$_SESSION["session_template_dir"]."/".$templateid."/images/".$captionbandname;
                                                                                   $imagewidth_height_type_array=explode(":",ImageType( $actualcaptionbandloc_inner));
                                                                                   $imagetype=$imagewidth_height_type_array[0];
                                                                                    if($_SESSION['session_edittype']=="edit"){
                                                                                             $assignedname="ug_innercaption_s".$siteid.".jpg";

                                                                                         }else{
                                                                                               $assignedname="ug_innercaption_t".$tmpsiteid.".jpg";
                                                                                         }
                                                                                   //$assignedname="ug_innercaption_t".$tmpsiteid.".jpg";;
                                                                                   $_SESSION['session_innercaptionbandname']=$assignedname;
                                                                            copy($actualcaptionbandloc_inner,$urllocation.$assignedname);
                                                                       chmod($urllocation.$assignedname,0777);
                                                                       $image = NewimageCreatefromtype($urllocation.$assignedname);

                                                                            /*check whether the text can be append in image.Otherwise chaneg the font size
                                                                                   $checkmaximumlengthaloowed=imagettfbbox ( $captionfontsize,0, "./fonts/".$selectedcaptionfont, $captionname);
                                                                                   $imageallowablwidth=$checkmaximumlengthaloowed[2]-$checkmaximumlengthaloowed[0];
                                                                                   $imageallowablheight=$checkmaximumlengthaloowed[1]-$checkmaximumlengthaloowed[7];
                                                                                   $innerimagewidth=$imagewidth_height_type_array[1];
                                                                                   $innerimageheight=$imagewidth_height_type_array[2];

                                                                                   if($imageallowablwidth<$innerimagewidth and $imageallowablheight<$innerimageheight){
                                                                                      ;
                                                                                   }else{
                                                                                      $i=1;
                                                                                      while($i<100){
                                                                                            $captionfontsize=$captionfontsize-1;
                                                                                            $checkmaximumlengthaloowed=imagettfbbox ( $captionfontsize,0, "./fonts/".$selectedfont, $captionname);
                                                                                                $imageallowablwidth=$checkmaximumlengthaloowed[2]-$checkmaximumlengthaloowed[0];
                                                                                        $imageallowablheight=$checkmaximumlengthaloowed[1]-$checkmaximumlengthaloowed[7];
                                                                                                if($imageallowablwidth<$innerimagewidth and $imageallowablheight<$innerimageheight){
                                                                                          break;
                                                                                        }
                                                                                            $i++;
                                                                                          }

                                                                                   }
                                                                                   $captionfontsize=$captionfontsize-($captionfontsize/3);*/
                                                                                   $captionfontsize=$captionfontsize-2;
                                                                                   $xcordinate=10;
                                                                                   $ycordinate=$imagewidth_height_type_array[2]/2;
                                                                                   $ycordinate=$ycordinate+5;
                                                                                        /*checking ends here*/
                                                                                          imagettftext($image, $captionfontsize,$angle, $xcordinate, $ycordinate, $textcolor, $font, $captionname);
                                                                                        $newfile = $urllocation.$assignedname;
                                                                                        NewImagetype($image,$newfile,$urllocation.$assignedname);
                                                                                        copy($newfile,"./usergallery/$userid/images/".$assignedname);
                                                                                        chmod("./usergallery/$userid/images/".$assignedname,0777);
                                                                                        chmod($newfile,0777);
                                                                                        if($_SESSION['session_published']!="yes")
                                                                                            watermarkimage($newfile);

                                                /*end of caption*/
                  }





                                                /*Meta keywords*/
                                                //echo $_POST['sitemetadesc'];
                                                       if(get_magic_quotes_gpc()==1){
                                                                $_SESSION['session_sitemetadesc']=trim($_POST['sitemetadesc']);
                                                                $_SESSION['session_sitemetakey']=trim($_POST['sitemetakey']);
                                                                $_SESSION['session_sitetitle']=trim($_POST['sitetitle']);
                                                                $_SESSION['session_sitemeemail']=trim($_POST['siteemail']);
                                                           }else{
                                                          $_SESSION['session_sitemetadesc']=addslashes(trim($_POST['sitemetadesc']));
                                                                  $_SESSION['session_sitemetakey']=addslashes(trim($_POST['sitemetakey']));
                                                                  $_SESSION['session_sitetitle']=addslashes(trim($_POST['sitetitle']));
                                                                  $_SESSION['session_sitemeemail']=addslashes(trim($_POST['siteemail']));
                                                                }

                                                         /* save the site details.for published site save it into tbl_site_mast
                                                         *  otherwise save it into tbl_tempsite_mast
                                                         */
                                                         if($errormessagefileupload==""){
                                                            //update tempsitemast
                                                                        if($_SESSION['session_published'] =="yes"){
                                                                             $qry="update tbl_site_mast set vtitle='".$_SESSION['session_sitetitle']."',vmeta_description='".$_SESSION['session_sitemetadesc']."',vmeta_key='".$_SESSION['session_sitemetakey']."',vlogo='".$_SESSION['session_logobandname']."',";
                                                                             $qry .="vcompany='".$_SESSION['session_companybandname']."',vcaption='".$_SESSION['session_captionbandname']."',vcolor='".$_SESSION['session_sitecolor']."',vemail='".$_SESSION['session_sitemeemail']."',ddate=now(),vdelstatus='0'";
                                                                             $qry .=",vsub_logo='".$_SESSION['session_innerlogobandname']."',vsub_caption='".$_SESSION['session_innercaptionbandname']."',vsub_company='".$_SESSION['session_innercompanybandname']."' ";
                                                                         $qry .=" where nsite_id='".$siteid."'";

                                                                             mysql_query($qry);
                                                                        }else{
                                                                             $qry="update tbl_tempsite_mast set vtitle='".$_SESSION['session_sitetitle']."',vmeta_description='".$_SESSION['session_sitemetadesc']."',vmeta_key='".$_SESSION['session_sitemetakey']."',vlogo='".$_SESSION['session_logobandname']."',";
                                                                             $qry .="vcompany='".$_SESSION['session_companybandname']."',vcaption='".$_SESSION['session_captionbandname']."',vcolor='".$_SESSION['session_sitecolor']."',vemail='".$_SESSION['session_sitemeemail']."',ddate=now(),vdelstatus='0'";
                                                                             $qry .=",vsub_logo='".$_SESSION['session_innerlogobandname']."',vsub_caption='".$_SESSION['session_innercaptionbandname']."',vsub_company='".$_SESSION['session_innercompanybandname']."' ";
                                                                         $qry .=" where ntempsite_id='".$tmpsiteid."'";
                                                                                 //echo $qry;
                                                                             mysql_query($qry);
                                                                    }
                                                                  $message="Site details saved successfully!!!!";

                                                         }


                }                                /**********/

}
//echo "assigned company name".$_SESSION['companyname'];
include "includes/userheader.php";
?>
<script>
         function validateform(){
                 return true;
                     frm=document.frmSiteDetails;
                         if(frm.filelogo.value=="" && document.getElementById("preview").innerHTML=="&nbsp;"){
                           alert("Please upload your logo");
                           return false;
                         }else if(frm.companyname.value==""){
                           alert("Please enter your company name");
                           return false;
                         }else if(frm.captionname.value==""){
                           alert("Please enter your caption name");
                           return false;
                         }

             return true;
                 }
         function insertourlogo(imageid){
                 //alert(document.getElementById("preview").innerHTML);
                    var imgtag="<img src='"+imageid+"' width='60' height='40' >";
                    document.getElementById("preview").innerHTML=imgtag;
                   //alert("test");
                 }
          function logosample(){
                       winname="LogoSample";
                           winurl="logosample.php";
                          document.getElementById("logooption2").checked=true;
                           window.open(winurl,winname,'width=400,height=560,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=no,minimize=no');


                  }
                  function checkupload(){
                    document.getElementById("logooption1").checked=true;
                  }
                  function changecolor(currentid){
                   winname="SiteBuilderchangecolor";
                           winurl="chnagefontcolor.php";
                           window.open(winurl,winname,'width=200,height=200,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,minimize=no');
              }
                  function changesitecolor(currentid){

                   winname="SiteBuilderchangesitecolor";
                           winurl="chnagesizecolor.php";
                          window.open(winurl,winname,'width=200,height=200,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,minimize=no');
             }
                 function setclrvalue(x){
                            document.getElementById("fontcolor").style.backgroundColor=x;
                           document.getElementById("fntclr").value=x;
                         changecompanyfont('');
             }
                 function setsiteclrvalue(x){
                     document.getElementById("sitecolor").style.backgroundColor=x;
                         //alert(x);
                           document.getElementById("stclr").value=x;
                 }
                  function changecaptioncolor(currentid){
                   winname="SiteBuilderchangecaptioncolor";
                           winurl="chnagecaptionfontcolor.php";
                           window.open(winurl,winname,'width=200,height=200,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,minimize=no');
              }
                  function setcaptionfontclrvalue(x){
                     document.getElementById("captfontcolor").style.backgroundColor=x;
                           document.getElementById("captfntclr").value=x;
                          changecaptionfont('');
                 }
                  function changecompanyfont(obj){
                            var company_name=document.getElementById("companyname").value;
                            var font_name=document.getElementById("compfont").value;
                                var font_size=document.getElementById("fontsize").value;
                                var font_clr=document.getElementById("fntclr").value;

                                company_name=escape(company_name);
                                var requesturl;
                                requesturl="showchangedimage.php?act=company&company_name="+company_name+"&font_name="+font_name+"&font_size="+font_size+"&font_clr="+font_clr.slice(1)+"&";
                                  var http;
if (window.XMLHttpRequest) {
  http = new XMLHttpRequest();
} else {
  try { 
    http = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try { 
      http = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
      http = false; 
    }
  }
}
                                  http.open("GET",requesturl,false)
                                    http.send();
                                  var newfilename=http.responseText;

                                  document.getElementById("companypriview").innerHTML=" <img src='"+newfilename+"'>";

                 }
                 function changecaptionfont(obj){
                            var caption_name=document.getElementById("captionname").value;
                            var font_name=document.getElementById("captionfont").value;
                                var font_size=document.getElementById("captionfontsize").value;
                                var font_clr=document.getElementById("captfntclr").value;


                                if(caption_name==""){
                                  alert("please enter caption name");
                                  return false;
                                }
                                caption_name=escape(caption_name);
                                var requesturl;
                                requesturl="showchangedimage.php?act=caption&caption_name="+caption_name+"&font_name="+font_name+"&font_size="+font_size+"&font_clr="+font_clr.slice(1)+"&";

                        var http;
if (window.XMLHttpRequest) {
  http = new XMLHttpRequest();
} else {
  try { 
    http = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try { 
      http = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
      http = false; 
    }
  }
}
                          http.open("GET",requesturl,false)
                            http.send();

                          var newfilename=http.responseText;

                          document.getElementById("captionpriview").innerHTML=" <img src='"+newfilename+"'>";

                 }



</script>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tr>
<td  valign="top" align=center>
                <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td class=errormessage><?php echo $errormessage;?></td>
                                </tr>
                            <?php if($errormessage==""){ ?>
                                <tr>
                                   <td class=maintextbold><?php echo $message; ?></td>
                                </tr>
                                <?php } ?>
                                <tr>
                                  <td>&nbsp;</td>
                                </tr>
                                <tr>
                                    <td class=maintext>Site name:&nbsp;<b><?php echo $_SESSION['session_sitename'];?></b></td>
                                </tr>
                <tr>
                <td >
                                <!-- Main section starts here-->
                                    <form name=frmSiteDetails method=post  enctype="multipart/form-data" onsubmit="return validateform();">
                                        <table width="100%"  border=0>
                                             <tr>
                                                   <td>
                                                      <FIELDSET>
                                                           <LEGEND class=maintextbigbold>Logo</LEGEND>
                                                              <table border="0" width="97%">
                                                                  <tr><td colspan=5>&nbsp;</td></tr>
                                                                    <tr><td colspan=5 class=errormessage><?php echo $errormessagefileupload;?></td></tr>
                                                                        <tr>
                                                                          <td ><input class=radiobutton type=radio name=logooption id=logooption value="N" checked></td>
                                                                          <td class=maintext colspan=4 align=left>
                                                                              No logos
                                                                          </td>
                                                                        </tr>
                                                                    <tr>
                                                                          <td ><input class=radiobutton type=radio name=logooption id=logooption1 value="U"></td>
                                                                          <td class=maintext width="30%" align=left>
                                                                              Upload your logo
                                                                          </td>
                                                                          <td align=left>
                                                                             <input class=textbox type=file name=filelogo ONCLICK="checkupload();">
                                                                          </td>
                                                                          <td width="30%">&nbsp;</td>
                                                                        </tr>
                                                                        <tr>
                                                                                <td class=maintext width="30%" align=left>&nbsp;</td>
                                                                                <td class=maintext align=left colspan=4 ><font size=1>
                                                                                  You can upload your site's logo to fit in to the site. If you don't have one, you can select from the samples provided by <?php echo($_SESSION["session_lookupsitename"]); ?>.


                                                                                 </font>
                                                                                </td>
                                                                        </tr>
                                                                        <tr><td colspan=5>&nbsp;</td></tr>


                                                                        <tr>
                                                                           <td ><input class=radiobutton type=radio name=logooption id=logooption2 value="S"></td>
                                                                           <td colspan=3  class=maintext align=center>
                                                                                    <a class=anchor href="javascript:logosample();">Select from our sample logos</a>
                                                                           </td>
                                                                           <td id=preview>&nbsp;</td>
                                                                        </tr>
                                                                        <tr><td colspan=5>&nbsp;</td></tr>
                                                                        <?php
                                                                            if($_SESSION['session_logobandname'] !=""){
                                                                                  echo "<script>document.getElementById('preview').innerHTML='';var imgtag=\"<img src='".$urllocation.$_SESSION['session_logobandname']."' width='60' height='40' >\";";
                                                                                  echo "document.getElementById('preview').innerHTML=imgtag;</script>";
                                                                                }

                                                       ?>
                                                                  </table>
                                                          </FIELDSET>



                                                   </td>
                                                 </tr>
                                                 <tr><td>&nbsp;</td></tr>
                                                 <tr>
                                                   <td>
                                                      <FIELDSET>
                                                            <LEGEND class=maintextbigbold>Company</LEGEND>
                                                                <table width="97%" border="0">
                                                                  <tr><td colspan=6>&nbsp;</td></tr>

                                                                 <tr>

                                                                           <td colspan=6 align=center id=companypriview>

                                                                      </td>
                                                                 </tr>

                                                                  <tr>
                                                                    <td class=maintext width="5%" align=left>Company</td>
                                                                        <td colspan=5  align=left width="30%">
                                                                          <input type=text class=textbox name=companyname size=40 maxlength=99 value="<?php echo htmlentities($_SESSION['session_comseltext']); ?>" onchange="changecompanyfont('');" id="companyname">
                                                                        </td>
                                                                  </tr>
                                                                  <tr>
                                                                                 <td class=maintext   width="5%" align=left>&nbsp;</td>
                                                                                <td class=maintext align=left colspan=5 ><font size=1>
                                                                                  The company name will be embedded as an image. Select the font properties like color, size and type to best fit to the overall site esthetics
                                                                                 </font>
                                                                                </td>
                                                                                </tr>
                                                                <tr><td colspan=6>&nbsp;</td></tr>
                                                                  <tr>
                                                                    <td class=maintext align=right width="5%">Font&nbsp;</td>
                                                                        <td align=left>
                                                                           <SELECT class=selectbox name=compfont id="compfont" onchange="changecompanyfont('');">


                                                                                                        <?php
                                                                                                           builFontSelectBox($_SESSION['session_comselfont']);

                                                                                                        ?>
                                                                           </SELECT>
                                                                        </td>
                                                                        <td class=maintext align=right>Size&nbsp;</td>
                                                                        <td align=left >
                                                                              <SELECT class=selectbox name=fontsize id="fontsize" onchange="changecompanyfont('');">
                                                                             <?php
                                                                                 for($i=10;$i<30;$i++){
                                                                                  if($i== $_SESSION['session_comselfontsize']) $selflag="selected";else $selflag="";
                                                                                                                         $fontsize .="<option value=$i $selflag>$i</option>";
                                                                                }
                                                                                echo $fontsize;
                                                                                 ?>

                                                                           </SELECT>
                                                                        </td>

                                                                        <td class=maintext align=right>Color&nbsp;</td>
                                                                        <td align=left>
                                                                           <input class=textbox id=fontcolor size=2 readonly style="background-color:black">
                                                                           <input STYLE="width:80px;" class=button type=button value="select color" onclick="changecolor(this.id);">
                                                                           <input type=hidden name=fntclr id=fntclr value="#000000">
                                                                        </td>
                                                                  </tr>
                                                                  <tr><td colspan=6>&nbsp;</td></tr>
                                                                </table>
                                                                <?php
                                                                            if($_SESSION['session_comselfontclr'] !=""){
                                                                                  echo "<script>document.getElementById('fontcolor').style.backgroundColor='".$_SESSION['session_comselfontclr']."';</script>";
                                                                                  echo "<script>document.getElementById('fntclr').value='".$_SESSION['session_comselfontclr']."';</script>";


                                                                                }

                                                       ?>

                                                          </FIELDSET>

                                                   </td>
                                                 </tr>
                                                  <tr><td>&nbsp;</td></tr>
                                                  <tr>
                                                   <td>
                                                     <FIELDSET>
                                                           <LEGEND class=maintextbigbold>Site Color</LEGEND>
                                                           <table width="97%" border="0">
                                                             <tr><td colspan=2>&nbsp;</td></tr>
                                                             <tr>
                                                                    <td class=maintext align=left width="20%">Select Color</td>
                                                                        <td align=left>
                                                                           <input class=textbox id=sitecolor size=5 readonly style="background-color:">
                                                                           <input STYLE="width:80px;" class=button type=button value="select color" onclick="changesitecolor(this.id);">
                                                                           <input type=hidden name=stclr id=stclr value="">
                                                                        </td>
                                                                 </tr>
                                                                  <tr>
                                                                                 <td class=maintext width="20%"  align=left>&nbsp;</td>
                                                                                <td class=maintext align=left colspan=5 ><font size=1>
                                                                                  Site color can also be changed to make variations in the overall look and feel of the site.

                                                                                 </font>
                                                                                </td>
                                                                                </tr>
                                                                  <tr>
                                                                 <tr><td colspan=2>&nbsp;</td></tr>
                                                           </table>
                                                         </FIELDSET>
                                                   </td>
                                                 </tr>
                                                 <?php
                                                    if($_SESSION['session_sitecolor'] !=""){
                                                          echo "<script>document.getElementById('sitecolor').style.backgroundColor='".$_SESSION['session_sitecolor']."';</script>";
                                                          echo "<script>document.getElementById('stclr').value='".$_SESSION['session_sitecolor']."';</script>";

                                                        }

                                                 ?>

                                                 <tr><td>&nbsp;</td></tr>
                                                 <tr>
                                                   <td >
                                                     <FIELDSET>
                                                           <LEGEND class=maintextbigbold>Caption</LEGEND>
                                                           <table width="97%" border="0">
                                                             <tr><td colspan=6>&nbsp;</td></tr>
                                                                 <tr>

                                                                           <td colspan=6 align=center id=captionpriview>

                                                                      </td>
                                                                 </tr>

                                                             <tr>
                                                                    <td class=maintext width="20%" align=left>Caption&nbsp;</td>
                                                                        <td align=left colspan=5>
                                                                          <input type=text class=textbox id="captionname" name=captionname maxlength=99 size=70 value="<?php echo htmlentities($_SESSION['session_capseltext']); ?>" onchange="changecaptionfont(this)">
                                                                        </td>
                                                                  </tr>
                                                                  <tr>
                                                                                 <td class=maintext width="20%"  align=left>&nbsp;</td>
                                                                                <td class=maintext align=left colspan=5 ><font size=1>
                                                                                  Site Caption will also be embedded as an image in the site. You can set the font properties for Site Caption also.


                                                                                 </font>
                                                                                </td>
                                                                                </tr>
                                                                  <tr>
                                                                  <tr><td colspan=6>&nbsp;</td></tr>
                                                                  <tr>
                                                                    <td class=maintext align=right >Font&nbsp;</td>
                                                                        <td align=left width="20%">
                                                                           <SELECT class=selectbox name=captionfont id="captionfont" onchange="changecaptionfont(this)">

                                                                                                   <?php
                                                                                                           builFontSelectBox($_SESSION['session_capselfont']);

                                                                                                        ?>
                                                                           </SELECT>
                                                                        </td>
                                                                        <td class=maintext align=right>Size&nbsp;</td>
                                                                        <td align=left >
                                                                           <SELECT class=selectbox name=captionfontsize id="captionfontsize"   onchange="changecaptionfont(this)">
                                                                             <?php
                                                                                 $i=0;
                                                                                 $fontsize="";
                                                                                 for($i=10;$i<30;$i++){
                                                                                                     if($i== $_SESSION['session_capselfontsize']) $selflag="selected";else $selflag="";
                                                                                                                         $fontsize .="<option value=$i $selflag>$i</option>";
                                                                                }
                                                                                echo $fontsize;
                                                                                 ?>

                                                                           </SELECT>
                                                                        </td>

                                                                        <td class=maintext align=left STYLE="width:20px;" >Color&nbsp;</td>
                                                                        <td align=left>
                                                                           <input class=textbox id=captfontcolor size=2 readonly style="background-color:black">
                                                                           <input  STYLE="width:80px;"  class=button type=button value="select color" onclick="changecaptioncolor(this.id);">
                                                                           <input type=hidden name=captfntclr id=captfntclr value="#000000">
                                                                        </td>
                                                                  </tr>
                                                                  <?php
                                                                            if($_SESSION['session_capselfontclr'] !=""){
                                                                                  echo "<script>document.getElementById('captfontcolor').style.backgroundColor='".$_SESSION['session_capselfontclr']."';</script>";
                                                                                  echo "<script>document.getElementById('captfntclr').value='".$_SESSION['session_capselfontclr']."';</script>";


                                                                                }

                                                       ?>
                                                                  <tr><td colspan=6>&nbsp;</td></tr>
                                                           </table>
                                                         </FIELDSET>
                                                   </td>
                                                 </tr>
                                                 <tr><td>&nbsp;</td></tr>
                                                 <tr>
                                                   <td>

                                                      <FIELDSET>
                                                             <LEGEND class=maintextbigbold>Others</LEGEND>
                                                                     <table width="97%" border="0">
                                                                            <tr><td colspan=3>&nbsp;</td></tr>
                                                                            <tr>
                                                                                  <td class=maintext width="30%"  align=left valing=top>Page Title&nbsp;</td>
                                                                                  <td align=left>
                                                                                       <input type=text class=textbox name=sitetitle size=40 maxlength=99 value="<?php echo htmlentities(stripslashes($_SESSION['session_sitetitle']));?>">

                                                                                  </td>
                                                                                </tr>
                                                                                <tr>
                                                                                 <td class=maintext width="30%"  align=left>&nbsp;</td>
                                                                                <td class=maintext align=left><font size=1>
                                                                                 The title of a page is what you see on the title bar or top bar of the browser, ie., the top-left corner of the browser</font>
                                                                                </td>
                                                                                </tr>
                                                                                <tr><td colspan=3>&nbsp;</td></tr>
                                                                                <!--<tr>
                                                                                  <td class=maintext width="30%"  align=left>Email&nbsp;</td>
                                                                                  <td align=left>
                                                                                       <input type=text class=textbox name=siteemail size=40 maxlength=99 value="<?php echo htmlentities(stripslashes($_SESSION['session_sitemeemail']));?>">

                                                                                  </td>
                                                                                </tr>-->
                                                                            <tr>
                                                                                  <td class=maintext width="30%"  align=left valing=top>Meta description&nbsp;</td>
                                                                                  <td align=left>
                                                                                        <TEXTAREA class=textbox name=sitemetadesc id=sitemetadesc rows=7 cols=40><?php echo htmlentities(stripslashes($_SESSION['session_sitemetadesc']));?></TEXTAREA>

                                                                                  </td>
                                                                                </tr>
                                                                                <tr>
                                                                                 <td class=maintext width="30%"  align=left>&nbsp;</td>
                                                                                <td class=maintext align=left><font size=1>
                                                                                  A META description is a one or two sentence description for each page with accurate and interesting description of the page. While creating pages, include the important keyword phrase in the meta description.</font>
                                                                                </td>
                                                                                </tr>
                                                                                <tr><td colspan=3>&nbsp;</td></tr>
                                                                                <tr>
                                                                                  <td class=maintext width="30%"  align=left valing=top>Meta keywords&nbsp;</td>
                                                                                  <td class=maintext align=left class=maintext>
                                                                                        <TEXTAREA class=textbox name=sitemetakey id=sitemetakey rows=7 cols=40><?php echo htmlentities(stripslashes($_SESSION['session_sitemetakey']));?></TEXTAREA>
                                                                              </td>
                                                                                </tr>

                                                                                <tr>
                                                                                 <td class=maintext width="30%"  align=left>&nbsp;</td>
                                                                                <td class=maintext align=left><font size=1>
                                                                                Meta Keywords contain the most important words in a page, with their plurals misspellings and variations. The content in this tag is ignored by some search engines but is worth doing. Fill in the content of the meta keywords tag with keywords and keyword phrases relevant to the topic of the page. Include common misspellings of keywords, mix in capitalized versions of appropriate words, as well as plurals. Don't separate words with commas. Never repeat words more than three or four times and be sure to separate repetitions and similar words.

                                                                                 </font>
                                                                                </td>
                                                                                </tr>
                                                                                <tr><td colspan=3>&nbsp;</td></tr>
                                                                         </table>
                                                                 </legend>
                                                          </FIELDSET>
                                                   </td>
                                                 </tr>
                                                 <tr><td>&nbsp;</td></tr>
                                                 <tr><td>
                                                    <input class=button type=submit name=btnsave value="Save">
                                                        <input class=button type=submit name=btnback value="Back">
                                                 </td></tr>
                                        </table>
                                        </form>
                                <!-- Main section ends here-->
                </td>
                </tr>
                                <tr><td>&nbsp;</td></tr>
                                <tr><td>&nbsp;</td></tr>
                <tr><td>&nbsp;</td></tr>
                                <tr><td>&nbsp;</td></tr>
                </table>
</td>
</tr>
</table>
<?php
   /************************************** show company band **********************************************************/
   if ($_SESSION['session_companybandname'] != "") {

?>
    <script>
          <?php
            $compimgurl= "var compimgurl=\"".$urllocation."/".$_SESSION['session_companybandname']."\";\n";
                echo $compimgurl;
          ?>
           document.getElementById("companypriview").innerHTML=" <img src='"+compimgurl+"'>";
        </script>
<?php
   }else{


 ?>
    <script>
          <?php
            $compimgurl= "var compimgurl=\"".$urllocation."/".$tp_company."\";\n";
                 echo $compimgurl;
          ?>
           document.getElementById("companypriview").innerHTML=" <img src='"+compimgurl+"'>";
        </script>
 <?php


   }
?>
<?php
 /************************************** show Caption band **********************************************************/
   if ($_SESSION['session_captionbandname'] != "") {

?>
    <script>
          <?php
            $captionimgurl= "var captionimgurl=\"".$urllocation."/".$_SESSION['session_captionbandname']."\";\n";
                echo $captionimgurl;
          ?>
           document.getElementById("captionpriview").innerHTML=" <img src='"+captionimgurl+"'>";
        </script>
<?php
   }else{


 ?>
    <script>
          <?php
            $captionimgurl= "var captionimgurl=\"".$urllocation."/".$tp_caption."\";\n";
                 echo $captionimgurl;
          ?>
           document.getElementById("captionpriview").innerHTML=" <img src='"+captionimgurl+"'>";
        </script>
 <?php


   }
?>
<?php
include "includes/userfooter.php";
?>