var menuOpt = 0;
var settingOpt = 0;
function closeSettingBox(){
if(settingOpt == 1){
settingOpt = 0;
$("#SettingButton").animate({"opacity":"0.75"},"fast");
$( "#SettingBox" ).slideUp("slow");
}
}
function setCenterElements(){
var pagewidth = $(window).width();
var iconwidth = $("#TopHeade").width();
var iconwidth2 = $("#Back2Top").width();
$("#TopHeader").css("left",(pagewidth/2)-(iconwidth/2));
//$("#TopHeader").fadeIn(1000);
//$("#Back2Top").css("left",(pagewidth/2)-(iconwidth2/2));
if($("#OuterWrapper").width()<1000){
$("#OuterWrapper").css("min-height","1500");
}else{
$("#OuterWrapper").css("min-height","1100");
}
}
$(window).ready(function(){
//for menu button
setCenterElements();
$(window).resize(function(){
setCenterElements();
});
var smode = 0;
$(window).bind('scroll',function(){
if($(window).scrollTop() >= 250 ){
if(smode != 1){
$("#Back2Top").animate({"bottom":"0px"},"fast");
$("#TopHeader").animate({"top":"0px"},"fast");
smode = 1;
}
}else if($(window).scrollTop() == 0){
$("#Back2Top").animate({"bottom":"-75px"},"fast");
$("#TopHeader").animate({"top":"-50px"},"fast");
smode = 0;
}
});
$("#Back2Top").click(function() {
if(smode != 0){
$("#Back2Top").animate({"bottom":"-75px"},"fast");
$("body,html").animate({scrollTop:0},"fast");
}
});
$("#MenuButton").click(function() {
if(menuOpt == 0){
$("#MenuButton span").fadeOut("fast");
$("#MenuButton").animate({"opacity":"0.75","width":"250px"},"fast");
$("#MenuBox").slideDown("fast");
//$("#OuterWrapper").animate({left:"250px"},"fast");
menuOpt = 1;
closeSettingBox();
}else{
$("#MenuButton").animate({"opacity":"1.0","width":"250px"},"fast");
$("#MenuButton span").fadeIn("fast");
$("#MenuBox").slideUp("fast");
//$("#OuterWrapper").animate({left:"0px"},"fast");
menuOpt = 0;
closeSettingBox();
}
});
$( "#MenuButton" ).hover(function() {
if(menuOpt == 0){
$("#MenuButton").animate({"opacity":"0.75"},"fast");
}
},function() {
if(menuOpt == 0){
$("#MenuButton").animate({"opacity":"1.0"},"fast");
}
});
//for setting button
$("#SettingButton").click(function() {
hideNotice();
if(menuOpt == 1){
$("#OuterWrapper").animate({left:"0px"},"fast");
$("#MenuButton").animate({"opacity":"0.75","width":"230px"},"fast");
$("#MenuButton span").fadeIn("fast");
$("#MenuBox").slideUp("fast");
menuOpt = 0;
}
$( "#SettingBox" ).slideToggle( "fast", function() {
if(settingOpt == 0){
settingOpt = 1;
$("#SettingButton").animate({"opacity":"0.75"},"fast");
}else{
settingOpt = 0;
$("#SettingButton").animate({"opacity":"1.0"},"fast");
}
});
});
$( "#SettingButton" ).hover(function() {
if(settingOpt == 0){
$("#SettingButton").animate({"opacity":"0.75"},"fast");
}
},function() {
if(settingOpt == 0){
$("#SettingButton").animate({"opacity":"1.0"},"fast");
}
});
//for login button
var loginOpt = 0;
$("#LogInButton").click(function() {
$( "#LogInBox" ).slideToggle( "fast", function() {
if(loginOpt==1){
$('#PressedLogInButton').attr("id","LogInButton");
loginOpt = 0;
}else{
$('#LogInButton').attr("id","PressedLogInButton");
loginOpt = 1;
}
});
});
$("#LogOut").click(function(){
window.location = "logout.php";
});
$("#RegisterButton").click(function(){
window.location = "register.html";
});
//for header 3 button's page: "Home", "Search Agent", "Property"
$(document).on("click","#sA",function(){
window.location = "searchagent.html?page=sA";
}); $(document).on("click","#sAG",function(){
window.location = "searchagency.html?page=sAG";
});
/*
$(document).on("click","#Hm",function(){
if(true){
window.location = "index.html";
}else{
window.location = "homepage.html";
}
});
//already moved to jscode.php
*/
$(document).on("click","#sP",function(){
window.location = "searchproperty.html?page=sP";
});
$("#NoticeBox").hide();
});
var nopt = 0;
function hideNotice(){
$("#NoticeBox").hide();
$("#noticeButton").css("opacity","1.0");
nopt = 0;
}
$(window).ready(function(){
$("#noticeButton").click(function() {
if(settingOpt == 1){
closeSettingBox();
}
$( "#NoticeBox" ).slideToggle( "fast", function() {
if(nopt==0){
$("#noticeButton").animate({"opacity":"0.75"},"fast");
$("#ntcnum").hide();
$.ajax({
url:"getnoticenum.php",
type:"POST",
data:"m=123",
dataType:"json",
cache: false,
async: false,
success:function(msg){
$("#ntcnum").html("
"+msg+"");
$("#ntcnum").fadeIn("fast");
$.ajax({
url:"getnotice.php",
type:"POST",
data:"m=0",
dataType:"html",
cache: false,
async: false,
success:function(msg){
$("#ntcnum").hide();
$("#NoticeMsgBox").html(msg);
$("#NoticeMsgBox").animate({scrollTop:0},"fast");
}
});
}
});
nopt = 1;
}else{
$("#noticeButton").animate({"opacity":"1.0"},"fast");
nopt = 0;
}
});
});
$( "#noticeButton" ).hover(function() {
if(nopt ==0){
$("#noticeButton").animate({"opacity":"0.75"},"fast");
}
},function() {
if(nopt ==0){
$("#noticeButton").animate({"opacity":"1.0"},"fast");
}
});
});
function setMSGBOX(){
var pagewidth = $(window).width();
var MBwidth = $("#MESSAGEBOX").width();
$("#MESSAGEBOX").css("left",(pagewidth/2)-(MBwidth/2));
}
function MSG(MESSAGE){
$("#MSGCON").html(MESSAGE);
$("#MSGBG").show();
$("#MESSAGEBOX").show();
return true;
}
var loadMETHOD;
function setLOADING(){
var pagewidth = $(window).width();
var LDwidth = $("#LDCON").width();
$("#LDCON").css("left",(pagewidth/2)-(LDwidth/2));
}
function LOADING(){
$("#ldText").html("Loading .");
$("#LDBG").fadeIn("fast");
$("#LDCON").fadeIn("fast");
var loadMETHOD= setInterval(function(){
var ldtext = $("#ldText").text();
switch(ldtext){
case "Loading .":
$("#ldText").html("Loading ..");
break;
case "Loading ..":
$("#ldText").html("Loading ...");
break;
case "Loading ...":
$("#ldText").html("Loading .");
break;
default:
$("#ldText").html("Loading ");
}
},300);
}
function LOADINGOUT(){
$("#LDBG").fadeOut("fast");
$("#LDCON").fadeOut("fast");
clearInterval(loadMETHOD);
}
function navVisible(){
if($(window).width()<=600){
$("#TopHeader").hide();
}else{
$("#TopHeader").show();
}
}
/*
//dy moved
*/
$(window).resize(function(){
setLOADING();
setMSGBOX();
navVisible();
if($("#footerCenter").width()<650){
$("#footerCenter ul").css("width","100%");
$("#footerCenter ul li:not(.linone)").css("border-bottom","0px");
}
});
$(window).ready(function(){
//$("#ntcnum").hide();
$("#MSGBG").hide();
$("#MESSAGEBOX").hide();
navVisible();
$("#CLOSEBUTTON").click(function(){
$("#MSGBG").hide();
$("#MESSAGEBOX").css({"width":"300px","overflow":"visible","max-height":"1000px","top":"35%"});
$("#MESSAGEBOX").hide();
});
/* var n = false;
if(n){
$.ajax({
url:"getnoticenum.php",
type:"POST",
data:"m=123",
dataType:"json",
cache: false,
async: true,
success:function(msg){
if(msg==0){
$("#ntcnum").hide();
}else{
$("#ntcnum").html(""+msg+"");
$("#ntcnum").fadeIn("fast");
}
}
});
} //dy moved
*/
});
/*
//dy moved
*/
$(document).ready(function(){
setLOADING();
setMSGBOX();
$(document).on("click",".holder a",function(){
$("body,html").animate({scrollTop:(($('.holder').first().offset().top)-75)},"fast");
});
$( "#LogInBox" ).hide();
//LOADING();
LOADINGOUT();
var windowSize = $(window).width();
if(windowSize<800){
$("meta[name='viewport']").attr("content","width=device-width, initial-scale=0.65, maximum-scale=0.70");
}else if(windowSize>=1000 && windowSize<=1300){
$("meta[name='viewport']").attr("content","width=device-width, initial-scale=0.80, maximum-scale=1.0");
}else{
$("meta[name='viewport']").attr("content","width=device-width, initial-scale=0.80, maximum-scale=1.0");
}
});
$(window).load(function(){
if($("#footerCenter").width()<650){
$("#footerCenter ul").css("width","100%");
$("#footerCenter ul li:not(.linone)").css("border-bottom","0px");
}
//LOADINGOUT();
/*var n = false;
if(n){
setInterval(function(){
$.ajax({
url:"getnoticenum.php",
type:"POST",
data:"m=123",
dataType:"json",
cache: false,
async: true,
success:function(msg){
if(msg==0){
$("#ntcnum").hide();
}else{
$("#ntcnum").html(""+msg+"");
$("#ntcnum").fadeIn("fast");
}
}
});
}, 2000);
}//moved dy */
});
$(window).ready(function(){
if($(window).width()<750){
$("#ContentMWrapper").css("width","95%");
$("#PContentWrapper").css("width","590px");
}else{
$("#ContentMWrapper").css("width","75%");
$("#PContentWrapper").css("width","98%");
}
if($(window).width()<=650){
$("#OuterWrapper").css("overflow","scroll");
$("#AContent").css("width","590px");
$("#AContent").css("min-width","590px");
}else{
$("#OuterWrapper").css("overflow","visible");
$("#AContent").css("width","100%");
$("#AContent").css("min-width","100%");
}
});
$(window).resize(function(){
if($(window).width()<750){
$("#ContentMWrapper").css("width","95%");
$("#PContentWrapper").css("width","590px");
}else{
$("#ContentMWrapper").css("width","75%");
$("#PContentWrapper").css("width","98%");
}
if($(window).width()<=650){
$("#OuterWrapper").css("overflow","scroll");
$("#AContent").css("width","590px");
$("#AContent").css("min-width","590px");
}else{
$("#OuterWrapper").css("overflow","visible");
$("#AContent").css("width","100%");
$("#AContent").css("min-width","100%");
}
});