<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH; ?>highslide/highslide-with-gallery.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo GLOBAL_ADMIN_JS_PATH; ?>highslide/highslide.css" />
<script type="text/javascript" src="<?php echo GLOBAL_ADMIN_JS_PATH; ?>powerpanel_alert.js"></script>
<script type="text/javascript">

    hs.graphicsDir = '<?php echo GLOBAL_ADMIN_JS_PATH; ?>highslide/graphics/';
    hs.align = 'center';
    hs.transitions = ['expand', 'crossfade'];
    hs.wrapperClassName = 'dark borderless floating-caption';
    hs.fadeInOut = true;
    hs.dimmingOpacity = .75;

    // Add the controlbar
    if (hs.addSlideshow) hs.addSlideshow({
        slideshowGroup: 'group1',
        interval: 5000,
        repeat: false,
        useControls: true,
        fixedControls: 'fit',
        overlayOptions: {
            opacity: .6,
            position: 'bottom center',
            hideOnMouseOut: true
        }
    });
</script>
<script type="text/javascript">
    function validate()
    {
//------------------------------title-----------------------------------
        if(trim(document.getElementById('var_title').value)== "")
        {
            alert("Please enter title.");
            document.getElementById('var_title').value= "";            
            document.getElementById('var_title').focus();
            return false;
        }
       
        if(checksame_title(document.getElementById('var_title').value)>0)
        {

            alert("This title is already exist.");
            document.getElementById('var_title').focus();
            return false;
        }
        //------------------------------alias-----------------------------------   
          if(trim(document.getElementById('var_alias').value) != "")
        {

            var str=document.getElementById('var_alias').value;

            var RE=/ /i;

            if (str.match(RE)==' ')
            {
                alert("Alias is not valid. Please remove space.");
                return false;
            }
        }
        
        if(document.getElementById('var_alias').value=="")
        {
            makeLowercase('var_title','var_alias');
        }
        var text1=document.getElementById('var_alias').value;
        var len1=text1.length;
        if(len1 == 1)
        {
            alert("Alias should be greater then  one character.");
            document.getElementById('var_alias').focus();
            return false;
        }
        
        if(!checkingAlias('var_alias','<?= base64_encode("service_category") ?>','<?= base64_encode($row['int_glcode']) ?>','<?= base64_encode('int_glcode') ?>',"pages"))
        {
            return false;
        } 
                        
        //-----------------------------end alias----------------------------            
       
        if(chkObject('int_displayorder') && document.getElementById('int_displayorder').value == "")
        {
            alert("Please enter display order.");
            document.getElementById('int_displayorder').focus();
            return false;
        }   
        if(document.getElementById('int_displayorder').value == "" || document.getElementById('int_displayorder').value==0)
        {
            alert("Please enter proper display order.");
            document.getElementById('asignbannerdisplay').style.display='';
            document.getElementById('int_displayorder').focus();
            return false;
        } 
        <?php if ($configObj->glSessionObj->value('admin_id') == '1' || DISPLAY_ALL_SEO == 'Y') { ?>
            copytext();        
        <?php } ?>
        document.getElementById('h_save').value ='T';
        return true;
    }
    
    function checksame_title(title)
    {
        var heid = $('#hid_eid').val();
        $.ajax({
            type: "GET",
            url:  "index.php" ,
            data: "module=service_category&ajax=Y&action=sametitle&id="+heid+"&title="+title,
            async: false,
            success: function(data)
            {
                if(data>0)
                    categoryexist = 1;
                else 
                    categoryexist = 0;
               
            }
            
        });
        return categoryexist;
    }
    
    function auto_alias(){
            if(document.getElementById('var_title').value != '' && document.getElementById('var_alias').value == '')
            {
                makeLowercase();
            }
        }
        
        function makeLowercase (var_title,var_alias)
        {
            if(typeof var_title=="undefined")
            {
                var_title="var_title";
            }
            if(typeof var_alias=="undefined")
            {
                var_alias="var_alias";
            }
            var str="";
            if($("#"+var_alias).val().length == 0)
                str= document.getElementById(var_title).value.toLowerCase();

            else
                sstr=$("#"+var_alias).val()
            str= str.toLowerCase();
            // alert(str);
            var temp = new String(str);
            temp =  temp.replace(/[^a-z A-Z 0-9 \-]+/g,'');
            temp=trim(temp);

            var strlength = temp.length;
            for(i=0;i<strlength;i++)
            {
                var alias = temp.split(' ').join('-');
            }

            document.getElementById(var_alias).value = alias;
        }
        
        function limitText(limitField, limitNum) {
            if (limitField.value.length > limitNum) {
                limitField.value = limitField.value.substring(0, limitNum);
            }
        }

        function valButton(btn) {
            var cnt = -1;
            for (var i=btn.length-1; i > -1; i--) {
                if (btn[i].checked) {cnt = i; i = -1;}
            }
            if (cnt > -1) return btn[cnt].value;
            else return null;
        }        

    function copytext()
        {
            if(document.getElementById('var_desc').checked==true ){
                var abcd=CKEDITOR.instances.text_fulltext.getData();
                var def=abcd.replace(/<a(\s[^>]*)?>.*?<\/a>/ig,"")
                var abc = def.replace(/^(\s*)|(\s*)$/g, '').replace(/\s+/g, ' ');
                var maintext=trim(removeHTMLTags(abc));
            }
                if(trim(document.getElementById('var_metatitle').value)=="")
                {
                    document.getElementById('var_metatitle').value=trim(document.getElementById('var_title').value).substr(0, 64);
                }
                CountLeft2(document.getElementById('var_metatitle'),document.frmlink.metatitle_left,200);
                
            if(document.getElementById('var_desc').checked==true ){    
                if(trim(document.getElementById('var_metakeyword').value)=="")
                {
                    document.getElementById('var_metakeyword').value=maintext.substr(0, 400);
                }
                CountLeft2(document.getElementById('var_metakeyword'),document.frmlink.metakeyword_left,400);
                if(trim(document.getElementById('var_metadescription').value)=="")
                {
                    document.getElementById('var_metadescription').value=maintext.substr(0, 400);
                }
                CountLeft2(document.getElementById('var_metadescription'),document.frmlink.metadescription_left,400);
            }
        }
        
   function CountLeft2(field, count, max) 
        {
            if (field.value.length > max)
            {
                field.value = field.value.substring(0, max);
            }
            else
            {
                count.value=max - field.value.length;
            }
        }              
    function chkObject (theVal)
    {
        if (document.getElementById(theVal) != null)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    
     function checkdatediscription()
    {
        if(document.getElementById('desc1').style.display =='none' || (document.getElementById('text_fulltext').value= ""))
        {
            document.getElementById('desc1').style.display='';
        }
        else
        {
            document.getElementById('desc1').style.display='none';
        }
    }
    
    function checkdatediscription1()
    {
        if(document.getElementById('desc2').style.display =='none' || (document.getElementById('var_general_info').value= ""))
        {
            document.getElementById('desc2').style.display='';
        }
        else
        {
            document.getElementById('desc2').style.display='none';
        }
    }
</script>

<?php if ($_REQUEST['action'] != '') $action = ucwords($_REQUEST['action']); ?>
<div class="breadcrumbs"><a href="index.php">Home </a>&nbsp;>&nbsp; <a href="index.php?module=service_category">Manage Service Categories</a>&nbsp; >&nbsp; <span class="current"><?= $action ?>  Service Category</span>  </div>
<div class="add-new-user-title">
    <h2><img alt="add-new-listing" src="<?= GLOBAL_ADMIN_IMAGES_PATH ?>/add-new-user-icon.png"><?= $action ?> Service Category
    <?php
        if($_REQUEST['action'] == 'edit'){
             $title=  $pservice_categoryObj->catnews($row['int_glcode']) ;
             echo "- ".$title;
        }
    ?>
    </h2>
</div>
<?= $messagebox ?>
<form  name="frmlink"  id="frmlink" action="<?php echo $frmlink; ?>" method="post"  onSubmit="return validate();" enctype="multipart/form-data" >
    <input type="hidden" name="fk_modules" id="fk_modules" value="<?php echo $fk_modules ?>">
    <input type="hidden" name="old_displayorder" id="old_displayorder" value="<?= $row['int_displayorder'] ?>">
    <input type="hidden" id="h_save" name="h_save" value="F" />
    <?php
    if ($row['int_displayorder'] != '') {
        $int_disporder = $row['int_displayorder'];
    } else {
        $int_disporder = '1';
    }
    if ($row['chr_publish'] != '') {
        $hidden_chr_publish = $row['chr_publish'];
    } else {
        $hidden_chr_publish = 'Y';
    }
    ?>
    <div class="web-booking-main">
        <div class="grid-list-subtitle-bg" style="margin-top:10px; cursor:pointer" onClick="javascript:expandcollapsepanel('asignbanner1');" >
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td align="left" valign="top" class="grid-td-left">Service Category Information</td>
                </tr>
            </table>
        </div>
        <div class="information-white-bg" id="asignbanner1" >
            <div class="clear"></div>
            <div class="grid-list-inner-table-text">
                <table width="100%" border="0" cellspacing="3" cellpadding="3" >
<!-------------------------------------------------------title--------------------------------->                    
                    <tr>
                        <td width="270" align="left" valign="top" class="add-new-user-text">Title: <span>(required)</span> </td>
                        <td width="856" colspan="3" align="left"  valign="top">                   
                            <input type="hidden" name="hid_eid" id="hid_eid" value="<?php echo $row['int_glcode'];?>">
                            <input name="var_title" type="text"  class="add-new-user-textarea" id="var_title" value="<?=  htmlspecialchars_decode($row['var_title'])?>"  maxlength="255" style="width:360px;"   />
                        </td>
                    </tr>
<!-------------------------------------------------------alias--------------------------------->                    
                    <?php if (DISPLAY_ALIAS == 'Y') { ?>
                        <tr>
                            <td  align="left" valign="top" class="add-new-user-text">Alias: <span>(auto)</span>  </td>
                            <td  width="75%" align="left" valign="top">
                                <table>
                                    <tr>
                                        <td>
                                            <input name="var_alias" type="text" style="width:360px;"  onblur="auto_alias();"  class="add-new-user-textarea fl" id="var_alias" value="<?= $row['var_alias']; ?>" maxlength="100"  />

                                            <div class="fl contact-comment-new position-relative mgl5 mgt5">
                                                <span class="help-icon1"></span>
                                                <div class="contact-hint fl" style="width: 390px; height:90px;  float: left;"><?php echo GLOBAL_ALIAS_NOTE; ?></div>
                                            </div>
                                        </td>
                                        <td>
                                            <a herf="javascript:;" onclick="checkingAlias('var_alias','<?= base64_encode("service_category") ?>','<?= base64_encode($row['int_glcode']) ?>','<?= base64_encode('int_glcode') ?>','pages');">Check Alias</a>
                                        </td>
                                        <td>
                                            <div id="aliasmsg" ></div>
                                        </td>
                                    </tr>
                                </table>
                            </td>

                        </tr>
                    <?php } else { ?>
                        <input name="var_alias" type="hidden" class="add-new-user-textarea" id="var_alias" value="<?= $row['var_alias']; ?>" maxlength="255"  />
                    <?php } ?>
                        
<!--                      <tr>
                    <td width="16%" align="left" valign="top" class="add-new-user-text"> Page Banner: </td>
                    <td width="60%" align="left" valign="top" >
                        <input type="file" name="var_image" id="var_image" class="mgl15" style="float: left" width="10px"/>
                        <div  id="divdelbro" style="float: left">&nbsp;
                    <?php
                            $imagename = $row['var_image'];
                            $imagepath = '../upimages/pagephoto/images/';
                             $image = $imagepath . "thumb_" . $imagename;
                            if ($imagename != "") {
                            if (file_exists($image) ) {
                    ?>
                    <a onClick="return hs.expand(this);"  style="text-decoration:none;" href="<?php echo "../upimages/pagephoto/images/" . trim($row['var_image']) ?>"><img  src="../upimages/pagephoto/images/thumb_<?= $row['var_image'] ?>" alt="View" width="30" height="30" border="0" align="absmiddle" id="myimage" />&nbsp;</a>
                            <a href="javascript:;" onclick="return fun_del_image1();">&nbsp;Delete</a>
                        <?php } else { ?> &nbsp;
                <?php } } else { ?>
                                <span class="fl mgt5 mgl10">(Only .bmp, .gif, .jpg, .jpeg, .png Image Formats are supported.)</span>
                            <?php } ?>
                        </div>
                        <span class="fl mgt5 mgl10"> &nbsp;(Required Size : <?php if ($_REQUEST['fk_recid'] == 1) {
            echo '(' . HOME_BANNER_WIDTH . 'px ' ?>  x  <?php echo HOME_BANNER_HEIGHT . 'px' . ')'; ?> <?php } else {
            echo '(' . INNERBANNER_WIDTH . 'px ' ?>  x  <?php echo '' . INNERBANNER_HEIGHT . 'px' . ')' ?><?php } ?>)</span>
                    </td>
                      </tr>
                      <tr>
                            <td width="16%" align="left" valign="top" class="add-new-user-text"></td>
                            <td width="60%" align="left" valign="top" >
                                  <span class="fl mgt5 mgl10">(Only .bmp, .gif, .jpg, .jpeg, .png Image Formats are supported.)</span>
                            </td>
                        </tr>-->
<!-------------------------------------------------------ck--------------------------------->  

                    <?php
                    if ($row['chr_displaycontent'] == 'N' && $row['int_glcode'] > 1) {
                        ?>
                        <input name="text_fulltext" type="hidden" class="add-new-user-textarea" id="text_fulltext" value="<?= $row['var_description']; ?>"/>
                        <?php
                    } else {
                        ?>
                        
                        <tr>
                            <td  align="left" valign="top" class="add-new-user-text" colspan="1"><div class="fl">Description:</div>

                                <div class=" contact-comment-new position-relative mgl5 fl">
                                    <span class="help-icon1"></span>
                                    <div class="contact-hint fl" style="width: 800px; height: 30px;"><?php echo GLOBAL_DESCRIPTION_NOTE; ?></div>
                                </div>
                           </td>
                           <td>
                                 <?php
                            if ($row['var_description'] != '') {
                                $id = 'checked = "checked"';                                
                                ?>
                                <?php
                            } else {                                
                                $id='';
                            }
                            ?>
                                <input type="checkbox" id="var_desc" name="var_desc" <?php echo $id; ?> value="Y" onclick="checkdatediscription()">
                            </td>                              
                        </tr>
                       
                        <?php
                    if ($row['var_description'] != '') {
                        $style = 'style="display:;"';
                    } else {
                        $style = 'style="display:none;"';
                    }
                    ?>
                        <tr id="desc1" name="desc1" <?= $style ?>>
                            <td  align="left" valign="top" class="add-new-user-text" colspan="4">
                                <?php echo $configObj->glLibraryObj->load_ckeditor('text_fulltext', $row['var_description']); ?>
                            </td>
                        </tr>
                        
                        <tr>
                        <td  align="left" valign="top" class="add-new-user-text"><div class="fl">General Information</div>
                            <div class=" contact-comment-new position-relative mgl5 fl">
                                <span class="help-icon1"></span>
                                <div class="contact-hint fl" style="width: 800px; height: 30px;">
                                    <?php echo GLOBAL_DESCRIPTION_NOTE; ?>
                                </div>
                            </div>                              
                        </td>
                        <?php
                        if ($row['var_general_info'] != '') {
                            $id_h = 'checked = "checked"';                                
                            ?>
                            <?php
                        } else {                                
                            $id_h='';
                        }
                        
                        if ($row['var_general_info'] != '') {
                            $style1 = 'style="display:;"';
                        } else {
                            $style1 = 'style="display:none;"';
                        }
                        
                        if(!empty($row['var_general_info'])) {
                            $general_info = $row['var_general_info'];
                        } else {
                            $general_info = "Prices are subject to change without notice.";
                        }
                        ?>
                        <td>
                            <input style="float: left" type="checkbox" id="var_h_info" name="var_h_info" <?php echo $id_h; ?> value="Y" onclick="checkdatediscription1()">
                        </td>
                    </tr>
                    <tr id="desc2" <?= $style1 ?>>
                        <td  align="left" valign="top"colspan="4" width="" class="add-new-user-text" >
                            <?php echo $configObj->glLibraryObj->load_ckeditor('var_general_info', $general_info); ?>
                        </td>
                    </tr>
                    </table>
            </div>
        </div>
                    <?php } ?>
        <div class="clear"></div>
<!--------------------------------------seo information--------------------->
<?php // if ($configObj->glSessionObj->value('admin_id') == '1' || DISPLAY_ALL_SEO == 'Y') { ?>
            <div class="grid-list-subtitle-bg" style="margin-top:10px; cursor:pointer;" onClick="javascript:expandcollapsepanel('asignbannerseo');" >
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td align="left" valign="top" class="grid-td-left">SEO Information</td>
                    </tr>
                </table>
            </div>
            <div class="information-white-bg" id="asignbannerseo" style="display:none;">
                <div class="clear"></div>
                <div class="grid-list-inner-table-text">
                    <?php echo $configObj->glLibraryObj->seo_textdetails($row['var_metatitle'], $row['var_metakeyword'], $row['var_metadescription']); ?>
                </div>
            </div>
            <div class="clear"></div>
        <?php // } else { ?>
<!--            <input name="var_metatitle" type="hidden"  id="var_metatitle" value="<?//= $row['var_metatitle']; ?>"  />
            <input name="var_metakeyword" type="hidden"  id="var_metakeyword" value="<?//= $row['var_metakeyword']; ?>" />
            <input type="hidden"  id="var_metadescription" name="<?//= $row['var_metadescription']; ?>" />-->
        <?php // } ?>
        </div>
<!--------------------------------seo end---------------------------------            -->        
    <div class="clear"></div>
   <div class="grid-list-subtitle-bg" style="margin-top:10px; cursor:pointer" onClick="javascript:expandcollapsepanel('asignbannerdisplay');" >
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td align="left" valign="top" class="grid-td-left">Display Information</td>
            </tr>
        </table>
        <?php
        if ($row['int_displayorder'] != '')
            $int_disporder = $row['int_displayorder'];
        else
            $int_disporder = '1';
        ?>
    </div>
    <div class="information-white-bg" id="asignbannerdisplay" style="display:none;">
        <div class="clear"></div>
        <div class="grid-list-inner-table-text">
            <table width="100%" border="0" cellspacing="3" cellpadding="3">
                 <tr>
                        <td width="215" align="left" valign="top" class="add-new-user-text">Display Order: <span>(required)</span></td>
                        <td colspan="2" align="left" valign="top">
                            <input name="int_displayorder" style="float: left; width: 50px; text-align: center;" type="text" class="date-textarea" id="int_displayorder" value="<?= $int_disporder; ?>" maxlength="3" onkeypress="return KeycheckOnlyNumeric(event);" />
                             <div class=" contact-comment-new position-relative mgt5 mgl10 fl" >
                            <span class="help-icon1"></span>
                            <div class="contact-hint fl" style="width: 700px; height: 30px;"><?php echo 'Package type are usually ordered alphabetically, but you may choose to put a number in the display order fields to change the page listing priority.'; ?></div>
                        </div> 
                        </td>
                </tr>
             
                    <tr>
                    <td height="30" width="255" align="left" valign="top" class="add-new-user-text">Display: <span>(required)</span></td>
                    <td width="106" height="30" align="left" valign="middle" class="add-new-user-text2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td width="48%">
                                    <?php if ($row['chr_publish'] == 'Y') { ?>
                                        <input type="radio" name="chr_publish" id="chr_publishY" value="Y" checked="checked" class="form-rediobutton " />
                                    <?php } else { ?>
                                        <input type="radio" name="chr_publish" id="chr_publishY" value="Y"  checked="checked" class="form-rediobutton "/><?php } ?>
                                    <a href="javascript:" onClick="if(document.getElementById('chr_publishY').checked!=true) document.getElementById('chr_publishY').checked=true;" style="text-decoration:none;">
                                        Yes</a></td>
                                <td width="52%"> <?php if ($row['chr_publish'] == 'N') { ?>
                                        <input name="chr_publish" type="radio" class="form-rediobutton " checked="checked" id="chr_publishN" value="N"    />
                                    <?php } else { ?>
                                        <input name="chr_publish" type="radio" class="form-rediobutton " id="chr_publishN" value="N"  /><?php } ?>
                                    <a href="javascript:" onClick="if(document.getElementById('chr_publishN').checked!=true) document.getElementById('chr_publishN').checked=true;" style="text-decoration:none;">
                                        No</a>
                                </td>
                            </tr>
                            <input name="int_displayorder" type="hidden"  id="int_displayorder" value="<?=$int_disporder; ?>"   />
                        <!--<input name="chr_publish" type="hidden"  id="chr_publish" value="Y"  />-->
                        </table></td>
                    <td width="864" align="left" valign="middle" class="add-new-user-text2"><img width="16" height="16" src="<?= GLOBAL_ADMIN_IMAGES_PATH ?>help.png" onmouseover="showDiv(event,'dvhlpvarwebsite')" onmouseout="hidediv('dvhlpvarwebsite');" alt="">
                        <div id="dvhlpvarwebsite" style=" z-index:99999; position: absolute;background-color: #d5ecfa;width: 400px;height:35px;padding: 10px;color:#0b336a;border: #95d0f2 2px solid;display: none;font-family:Tahoma, Arial, Verdana;font-size:13px;font-weight:bold;">Note : Please select 'Yes' if you want to display / activate this record. Otherwise please select 'NO'. </div></td>
                </tr>
              <?php //  } } ?>
            </table>
        </div>
    </div>
    <br />
    <?= $BottomSubmitButtons ?>
    <div class="clear"></div>
    <div class="add-new-user-button"></div>
</div>
</form>

