﻿//<!--
function toggleSlideDisplay(symbol, content, current, count) {        
    for (i = 1; i <= count; i ++) {
        var elem = document.getElementById(content + i);
        var elem_img = document.getElementById(symbol + i);
        if (elem) {
            elem.className = "hide";
            elem_img.innerHTML = '<img src="../img/com/tplus.gif" alt="Click here to expand"/>'; 
        }
    }
    var elem1 = document.getElementById(content + current);
    elem_img1 = document.getElementById(symbol + current);
    if (elem1) {
       elem1.className = "service_body show";
       elem_img1.innerHTML = '<img src="../img/com/tminus.gif" alt="Click here to expand"/>'; 
    }
}

function toggleDisplay(symbol, content, current) {  
    var tab = document.getElementById(content + current);
    var img = document.getElementById(symbol + current);
    if (tab) {
		if (tab.className == "service_body show" || tab.className == "service_body") {
			tab.className = "hide";
			//tab.style.visibility = "";
			//tab.style.display = "none";
			img.innerHTML = '<img src="../img/com/tplus.gif" alt="Click here to expand"/>';
		}
		else {
			tab.className = "service_body show";
			//tab.style.visibility = "visible";
			//tab.style.display = "inline-block";
			img.innerHTML = '<img src="../img/com/tminus.gif" alt="Click here to collapse"/>'; 
		}
    }
}

function toggleContactTabs(ctab, ttab) {        
    for (i = 1; i <= ttab; i ++) {
        var mnuTab = document.getElementById('mnuTab' + i);
        var conTab = document.getElementById('conTab' + i);
        if (conTab) {
            conTab.className = "contact_us contact_us_hide";
			mnuTab.className = "contact_tab_normal";
        }
    }
    mnuTab = document.getElementById('mnuTab' + ctab);
    conTab = document.getElementById('conTab' + ctab);
    if (conTab) {
       conTab.className = "contact_us contact_us_show";
       mnuTab.className = "contact_tab_selected";
    }
}

function toggleFurnishingTabs(ctab, ttab) {        
    for (i = 1; i <= ttab; i ++) {
        var mnuTab = document.getElementById('mnuTab' + i);
        //var conTab = document.getElementById('conTab' + i);
        if (mnuTab) {
           // conTab.className = "furnish_list contact_us_hide";
			mnuTab.className = "contact_tab_normal";
        }
    }
    mnuTab = document.getElementById('mnuTab' + ctab);
    //conTab = document.getElementById('conTab' + ctab);
    if (mnuTab) {
       //conTab.className = "furnish_list contact_us_show";
       mnuTab.className = "contact_tab_selected";
    }
}

function changeImage(displayId, imageId, imageUrl) {
	var dis = document.getElementById(displayId);
	var img = document.getElementById(imageId);
	if (dis) dis.innerHTML = '<img src="../img/pack/' + imageUrl + '" alt="" />';;
	//alert(imageUrl);
}

function toggleSearch (tab, type, img) {
	var stab = document.getElementById(tab);
	var imgTab = document.getElementById(img);
	if (stab) {
		if (type==0) {
			stab.className="hide";
			if (imgTab) imgTab.className = "more01";
		}
		else {
			stab.className="search_content";
			if (imgTab) imgTab.className = "hide";
		}
	}
}

function toggleLogin () {
	//alert('hi');
	var tab = document.getElementById("tabLogin");
	if (tab) {
		if (tab.className == "login show" || tab.className == "login")
			tab.className = "hide";
		else
			tab.className = "login show";
	}
}

function loadScript(url) {
  document.write('<script src="', url, '" type="text/javascript"></script>');
}

function roundNumber(num, dec) {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}

function convertSqFt_SqMt(val, cfrom, cto) {
	var ret = 0;
	if (cfrom != cto) {
		ret = 0;
	}
	else {		
		switch (cfrom) {
			case '1': // Sq. Feet to Sq. Meter
				ret = val * 0.09290304;				
				break;
				
			case '2': // Sq. Meter to Sq. Feet
				ret = val / 0.09290304;				
				break;
		}
		var txt = document.getElementById("txtTo");
		txt.value = roundNumber (ret, 4);
	}	
}

function changePopUpImage(id, count, bigImg) {
	var imgBig = document.getElementById("imgBig");
	var imgZoom;
	for (i = 1; i <= count; i ++) {
		imgZoom = document.getElementById("imgZoom" + i);
		imgZoom.className = "hide";
	}
	imgZoom = document.getElementById("imgZoom" + id);
	imgZoom.className = "show";
	imgBig.src = "../img/property/" + bigImg;
}

function toggleImage(imgSrc, img) {
	//var im = document.getElementById(imgSrc);
	imgSrc.src = img;
}


function bookmarkSite1(){
	//title = document.getElementsByTagName('title')[0];
	//if (title) title = title.nodeValue;
	//	alert(title.innerHTML);
	title = document.title;
	url = document.location.href;
	if (window.sidebar) { // Mozilla Firefox Bookmark	
		window.sidebar.addPanel(title, url,"");	
	} else 
	if( window.external ) { // IE Favorite		
		window.external.AddFavorite( url, title); 
	}	
	else if(window.opera && window.print) { // Opera Hotlist		
		return true; }
	
}

function bookmarkSite(){
	title = document.title;
	url = document.location.href;
 	var ua=navigator.userAgent.toLowerCase();
    var isKonq=(ua.indexOf('konqueror')!=-1);
    var isSafari=(ua.indexOf('webkit')!=-1);
    var isMac=(ua.indexOf('mac')!=-1);
    var buttonStr=isMac?'Command/Cmd':'CTRL';

    if(window.external && (!document.createTextNode ||
      (typeof(window.external.AddFavorite)=='unknown'))) {
        // IE4/Win generates an error when you
        // execute "typeof(window.external.AddFavorite)"
        // In IE7 the page must be from a web server, not directly from a local 
        // file system, otherwise, you will get a permission denied error.
        window.external.AddFavorite(url, title); // IE/Win
    } else if(isKonq) {
      alert('You need to press CTRL + B to bookmark our site.');
    } else if(window.opera) {
      void(0); // do nothing here (Opera 7+)
    } else if(window.home || isSafari) { // Firefox, Netscape, Safari, iCab
      alert('You need to press '+buttonStr+' + D to bookmark our site.');
    } else if(!window.print || isMac) { // IE5/Mac and Safari 1.0
      alert('You need to press Command/Cmd + D to bookmark our site.');    
    } else {
      alert('In order to bookmark this site you need to do so manually '+
        'through your browser.');
    }
}
//-->