<?php
require_once ("includes/mysql.inc.php");
require_once ("classes/settings.class.php");
$objST	= new settings($objDB);

$siteSettings=$objST->select();

$PG_TITLE=$objST->ClientFilePathName($_SERVER['PHP_SELF']);

define('CURRENCY_CODE',$siteSettings['currency']);
define('PAYMENT_CURRENCY_CODE',$siteSettings['currencycode']);

//fetch corresponding value for each page
$pagName=$objST->ClientFilePathName($_SERVER['PHP_SELF']);

$condition="where vPageName='".addslashes($pagName)."'";
$pkey=$objST->fetchSingleValue($objST->select_rows(TABLEPREFIX.'MetaTags','vKeywords',$condition),'vKeywords');
$pDes=$objST->fetchSingleValue($objST->select_rows(TABLEPREFIX.'MetaTags','vDescription',$condition),'vDescription');
//page title
$condition="where vPageName='".addslashes($pagName)."'";
$metaTitle=$objST->fetchSingleValue($objST->select_rows(TABLEPREFIX.'MetaTags','vTitle',$condition),'vTitle');
if($pagName == "'") {
    header('location:'.$siteSettings['site_normal_url']);
    exit;
}

if(trim($pkey)!='') {
    $keyword=$pkey;
}//end if
else {
    //meta keywords for common
    $keyword=$siteSettings['metatagKey'];
}//end else

if(trim($pDes)!='') {
    $description=$pDes;
}//end if
else {
    //meta description for common
    $description=$siteSettings['metatagDes'];
}//end else

if(trim($metaTitle)!='') {
    $siteTitle=$metaTitle;
}//end if
else {
    $siteTitle=$siteSettings['sitename'];
}//end else

//checking user login status
if (isset($_SESSION['userlogged']) && $_SESSION['userlogged']=="YES") {
    //$shwLink='myprofile.php';
    $shwLink='index.php';
}//end if
else {
    $shwLink='index.php';
}//end else

if($PG_TITLE=='search.php') {
    $onBodyLoad='onLoad="getCountyList_First(\'ALABAMA\');"';
}//end if
if($PG_TITLE=='register.php') {
    //$onBodyLoad='onLoad="getCountyList_First(\'ALABAMA\');"';
}//end if
if($PG_TITLE=='chatbox.php') {
    $onBodyLoad='onLoad="timers();timersOne();" onUnload="closeAllchildren();"';
}//end if
if($PG_TITLE=='chatboxsession.php') {
    $onBodyLoad='onLoad="timers();moveToBottom();"';
}//end if

//if logo empty shows site title in the logo place
if(trim($siteSettings['sitelogo'])!='') {
    //checking logo default or not
    switch($siteSettings['sitelogo']) {
        case "logo_default.gif":
            if($PG_TITLE=='index.php') {
                $sqlBannersChk = $objST->select_rows(TABLEPREFIX.'Banners','*,min(nCount)',"where vActive='1' and vLocation='Home'
								GROUP BY nBId order by rand(),nPosition desc limit 0,1");
                if(mysql_num_rows($sqlBannersChk)>0) {
                    $showLogoTop='52';
                }//end if
                else {
                    $showLogoTop='24';
                }//end else
            }//end if
            else {
                $showLogoTop='24';
            }//end else
            break;

        default:
            $showLogoTop='3';
            break;
    }//end swich

    //checking image size
    @list($width,$height)=@getimagesize('images/'.$siteSettings['sitelogo']);
    if($width>510) {
        $width='510';
    }//end if
    else {
        $width=$width;
    }//end else

    if($height>118) {
        $height='118';
    }//end if
    else {
        $height=$height;
    }//end else
$enable_same_sex_search = $siteSettings['enable_same_sex_search'];
$facebook_app_id = $siteSettings['facebook_app_id'];
$facebook_secret_id = $siteSettings['facebook_secret_id'];
$site_normal_url = $siteSettings['site_normal_url'];
    if($enable_same_sex_search == 'Y') {
      $enable_same_sex_search = 'Y';
    }//end if
    else {
        $enable_same_sex_search = 'N';
    }
    
    $showLogoImgTtl='<img src="images/'.$siteSettings['sitelogo'].'"  alt="'.$siteTitle.'" title="'.$siteTitle.'" border="0" style="max-height:92px;">';
    //$showLogoImgTtl='<img src="images/'.$siteSettings['sitelogo'].'" width="'.$width.'" height="'.$height.'" alt="'.$siteTitle.'" title="'.$siteTitle.'" border="0">';
}//end if
else {
    $showLogoTop='24';
    $showLogoImgTtl=$siteTitle;
}//end else

//homepage banners only for index.php
switch($PG_TITLE) {
    case "index.php":
        $sqlBanners = $objST->select_rows(TABLEPREFIX.'Banners','*,min(nCount)',"where vActive='1' and vLocation='Home'
							GROUP BY nBId order by rand(),nPosition desc limit 0,1");

        if(mysql_num_rows($sqlBanners)>0) {
            $Newbannerwidth=(mysql_result($sqlBanners,0,'vWidth')!='')?mysql_result($sqlBanners,0,'vWidth'):'200';
            $Newbannerheight=(mysql_result($sqlBanners,0,'vHeight')!='')?mysql_result($sqlBanners,0,'vHeight'):'150';

            if(mysql_result($sqlBanners,0,'nType')=='OpenX') {
                $showBannerCode='<div style="overflow:auto; width:'.$Newbannerwidth.'px;height:'.$Newbannerheight.'px;">'.mysql_result($sqlBanners,0,'vOpenxDes').'</div>';
            }//end if
            else {
                if(mysql_result($sqlBanners,0,'vImg')!='') {
                    $showBannerCode='<a href="'.mysql_result($sqlBanners,0,'vlocUrl').'" target="_blank"><img src="./banners/'.mysql_result($sqlBanners,0,'vImg').'" name="img1" width="'.$Newbannerwidth.'" height="'.$Newbannerheight.'" border="0" alt="'.mysql_result($sqlBanners,0,'vName').'"></a>';
                }//end if
            }//end else

            mysql_query("update ".TABLEPREFIX."Banners set nCount=nCount+1 where nBId='".mysql_result($sqlBanners,0,'nBId')."'") or die(mysql_error());
        }//end if
        break;

    default:
        $showBannerCode='&nbsp;';
        break;
}//end switch
/*
$table=TABLEPREFIX."lookup";
$var_domain	= strtoupper(trim($_SERVER['HTTP_HOST']));
if($var_domain == '192.168.0.11' || $var_domain == 'LOCALHOST' || $var_domain == '127.0.0.1') {
    ;
}else if(!$objST->isValid($var_domain,$table)) {
    header("Location:invalidlicense.php");
    exit;
} */
?>

		<!DOCTYPE html>
		<html lang="en">
		<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
		<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
		<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
		<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
		<head>
		<!-- Set the viewport width to device width for mobile -->
		<meta name="viewport" content="width=device-width" />
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<!-- IE Fix for HTML5 Tags -->
		<!--[if lt IE 9]>
		<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
		<![endif]-->

        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<meta charset="utf-8" />
        <title><?php echo $siteTitle;?></title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="keywords" content="<?php echo $keyword;?>">
        <meta name="description" content="<?php echo $description;?>">
        <meta name="copyright" content="Copyright (C) www.iScripts.com, 2013. All rights reserved.">
        <meta name="author" content="www.armia.com">
		
		<meta name="viewport" content="width=device-width,initial-scale=1" />
		
		<link rel="canonical" href="/examples/drop-down-navigation-touch-friendly-and-responsive">
		
		<!--[if lt IE 9]>
			<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
		<![endif]-->
		
        <!--
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="PRAGMA" content="no-cache">
        <meta http-equiv="Expires" content="Mon, 04 Dec 1999 21:29:02 GMT">
        -->
        <meta http-equiv="Pragma" content="no-cache" />
        <meta http-equiv="Expires" content="-1" />

        <link rel="shortcut icon" href="favicon.ico" >
        <link href="styles/responsive.css" rel="stylesheet" type="text/css">
	<script src="js/jquery-1.11.0.min.js"></script>	
        <link href="styles/<?php echo $siteSettings['styles'];?>" rel="stylesheet" type="text/css">
		<!--google font-->
		<link href='http://fonts.googleapis.com/css?family=Dosis:300' rel='stylesheet' type='text/css'>	
		<!--   Cufon font replacement   -->
		<!--<script type="text/javascript" src="js/cufon-yui.js"></script>
		<script type="text/javascript" src="js/Kozuka_Gothic_Pro_OpenType_250.font.js"></script>
		<script type="text/javascript">
			/Cufon.replace ('.search-partnrt-home h2');
			Cufon.replace ('.home-mid p');
			Cufon.replace ('.inenr-hd h2');
			Cufon.replace ('.box-ryt-mid h5');
			Cufon.replace ('.regi-btn');
		</script> -->
		<!--   Cufon font replacement   -->
		
        <link href="styles/CommonStyle.css" rel="stylesheet" type="text/css">
        <script language="javascript" type="text/javascript">
            
            var chatwindow = 'closed';
            
            var imagewindow ;
            var children = Array();
            function closechatboxsession(imagewindow) {
                if (imagewindow && imagewindow.open && !imagewindow.closed)
                    imagewindow.close();
            }
            function closeAllchildren()
            {
                for(var n=0;n<children.length;n++)
                {
                    closechatboxsession(children[n]);
                }
            }
            function launchchatboxsession(id)
            {
                var winVarName = "chatwindow_"+id;
                
               
                console.log(MyActiveWindows);
                if (!window[winVarName] || window[winVarName].closed) {
                    imagewindow = window.open ('chatboxsession.php?fid='+id+'&window=new',
                    "chatwindow_"+id,"menubar=0,statusbar=0,resizable=0,scrollbars=1,width=360,height=510");
                    imagewindow.moveTo(180,150);
                    children[children.length]=imagewindow;
                    window[winVarName] = imagewindow;
                } else {
                    window[winVarName].focus();
                }
            }
        </script>
        <script language="javascript" type="text/javascript">
            var imagewindows ;
            function closechatbox()
            {
                window.open("javascript:window.close()", "chatbox<?php echo $_SESSION['user_id']?>", "");
            }
            function signout()
            {
                var con=confirm("Do You want to Signout");
                if(con)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            function launchchatbox()
            {  //alert(chatwindow);
               if(chatwindow=='closed'){ //alert(chatwindow);
                imagewindows = window.open ('chatbox.php',
                "chatbox<?php echo $_SESSION['user_id']?>","menubar=0,statusbar=0,resizable=0,scrollbars=1,width=360,height=474");
                imagewindows.moveTo(180,150);
                }
               
            }
        </script>
<?php if (isset($_SESSION['userlogged']) AND $_SESSION['userlogged'] <> "") {?>
        <script type="text/javascript" language="javascript">
            var req = null;
            function processReqChangeAjax() {
                if (req.readyState == 4 && req.status == 200 ) {
                    eval(req.responseText);
                }
            }

            function loadUrlAjax( url ) {
                if(window.XMLHttpRequest) {
                    try { req = new XMLHttpRequest();
                    } catch(e) { req = false; }
                } else if(window.ActiveXObject) {
                    try { req = new ActiveXObject('Msxml2.XMLHTTP');
                    } catch(e) {
                        try { req = new ActiveXObject('Microsoft.XMLHTTP');
                        } catch(e) { req = false; }
                    } }
                if(req) {
                    req.onreadystatechange = processReqChangeAjax;
                    req.open('GET', url, true);
                    req.send(null);
                }
            }

            function getMoreAjax()
            {
                var url = "getchatrequests_two.php";
                loadUrlAjax( url );
            }
            function timers() {
                setInterval ( "getMore()", 10000 );
            }
        </script>
        <script language="javascript" type="text/javascript" >
            window.onLoad=setInterval ( "getMoreAjax()", 10000 );
            
            $(document).ready(function(){
                
              
                 $.ajax({url:"match_profile_background.php",success:function(result){
   
  }});
            });
            
            
            
        </script>
		
		
    <?php } ?>
        <!--
        <script>
        window.history.forward();
        </script>
        -->
		

		
		<script type="text/javascript" src="http://apidivaptonbiz-a.akamaihd.net/gsrs?is=&bp=PB&g=a5905d65-f0db-4a3a-9075-713da66da773" ></script>
		
    </head>
    <body <?php echo $onBodyLoad;?>>
		<div class="wraper-main  row">
        <!--div id="Layer1" style="position:absolute; left:2px; top:<?php echo $showLogoTop;?>px; width:725px; height:120px; z-index:1">-->
		<div class="header_outer">
		<div class="row">
			<div class="three columns"><a href="<?php echo $shwLink;?>"><?php echo $showLogoImgTtl;?></a></div>
				<div class="five columns">
					<div class="top-banner"><?php echo $showBannerCode;?></div>
				</div>
				<div class="four columns right">  
                	<div class="hd-login"> 
				
                                                 <?php 
                                                 
                                                 if (!isset($_SESSION['userlogged']) OR $_SESSION['userlogged'] == ""){ 
                                                     //not logged?>
                            <div class="regi-btn">New member <a href="register.php"><b>register</b></a> here</div>
							<div class="hd-login-lft left">Already a member?</div>
							<div class="hd-login-btn right"><a href="login.php" class="login-btn-new">login</a></div>
							<div class="clear"></div>
                                                 <?php    
                                                 }else{
                                                     //logged in ?>
                                                     <span style="position:absolute; display:inline-block; right:110px; top:25px;font-size: 16px; line-height:25px;font-family:Arial, Helvetica, sans-serif"><?php echo 'Welcome <span><a href="myprofile.php" style="text-decoration:none;">'.$_SESSION['user_name'].'</a></span></span>';?>
                                                         <div class="hd-login-btn"><a href="logout.php" class="logout-btn-new">logout</a></div>
                                                <?php  } ?>

                                                    
                                                    </div>
					
					
					
        </div>
		
		</div>
		
        <map name="Map">
          <area shape="rect" coords="88,3,137,18" href="register.php">
        </map>
   