//alert(locationReplaced)
try{
	locationReplaced = locationReplaced
}catch(err){
	var locationReplaced = false
}


if (self == top){

//top.location = location.hash
	anchorPos = top.document.URL.indexOf("#")
	//alert(anchorPos)
	//if (anchorPos > 0){
	if (anchorPos > ("http://" + document.domain).length){
		var anchor = top.document.URL.substring(anchorPos + 1 + 1)
		//alert(anchor)
		if (locationReplaced){
		//	locationReplaced = (locationReplacedTo == anchor)
		}
	if (!locationReplaced){
		var actionPos = anchor.indexOf("/")
		switch (anchor.substring(0, actionPos)){
			case "prdoduct": top.location.replace("http://" + document.domain + anchor.substring(actionPos));break;
			//default: top.location.replace("http://" + document.domain + anchor);
			default: top.location.replace("http://" + document.domain + "?l=" + anchor);
		}
		//top.location = "http://" + document.domain + top.document.URL.substring(anchor + 1)
	}
}
}
// important line
if (top.name != "") top.name = "";


var isIE = (navigator.appName == 'Microsoft Internet Explorer')
var pageListLeft = 0;
var pageListTop = 0;



function clipboardCopyURL(value){	
	//window.clipboardData.setData('Text', "http://www.polountai.com" + value)
	window.clipboardData.setData('Text', "http://" + document.domain + value)
}



var panelListURL = ""
var panelListTitle = ""
var panelContentURL = ""
var panelContentTitle = ""
function setURLmain(){
	//also in main.asp
	//if (name == "productsList"){
		top.document.title = panelContentTitle
		anchor = top.document.URL.indexOf("#")
		if (anchor > 0){
			//top.location.replace(top.document.URL.substring(0, anchor) + "#!/&_c&" + panelContentURL + "&_l&" + panelListURL)
			top.location.replace(top.document.URL.substring(0, anchor) + "#!" + panelContentURL+ "&?&" +  panelListURL)
		}else{
			top.location.replace(top.location + "#!" + panelContentURL+ "&?&" +  panelListURL)
		}
	//}
}
function setURLList(){
	top.panelListURL = this.document.URL.substring(("http://").length + document.domain.length)
	top.panelListTitle = document.title
	top.setURLmain();
}
function setURLContent(){
	top.panelContentURL = this.document.URL.substring(("http://").length + document.domain.length)
	top.panelContentTitle = document.title
	top.setURLmain();
}
function setURLno(){
	//also in main.asp
	//if (name == "productsList"){
		top.document.title = document.title
		anchor = top.document.URL.indexOf("#")
		if (anchor > 0){
			top.location.replace(top.document.URL.substring(0, anchor) + "#!" + this.document.URL.substring(("http://").length + document.domain.length))
		}else{
			top.location.replace(top.location + "#!" + this.document.URL.substring(("http://").length + document.domain.length))
		}
	//}
}

function setURL2(){
	//also in main.asp
	//if (name == "productsList"){
		top.document.title = document.title
		anchor = top.document.URL.indexOf("#")
		if (anchor > 0){
			top.location.replace(top.document.URL.substring(0, anchor) + "#!" + this.document.URL.substring(("http://").length + document.domain.length))
		}else{
			top.location.replace(top.location + "#!" + this.document.URL.substring(("http://").length + document.domain.length))
		}
	//}
}

var descriptionAdStarted
function scrollH(){
	var top = document.body.scrollTop;
	var frameHeight = document.body.offsetHeight
	if (!descriptionAdStarted){
		if (advertisementPosition != null){
			if (top + frameHeight +80 > advertisementPosition.offsetTop){
				if (adIframe.adCell != null){
					descriptionAdStarted = true;
					tempHTML = adIframe.adCell.innerHTML;
					adIframe.adCell.innerHTML = tempHTML;
				}
			}
		}
	}
}

var descriptionAdTimer
function descriptionAdStart(){
	if (!descriptionAdStarted){
		clearTimeout(descriptionAdTimer)
		descriptionAdTimer = setTimeout("scrollH()", 50)
	}
}


	function replaceAll(text, find, replace){
		while (text.indexOf(find) != -1) {
			text = text.replace(find, replace)
		}
		return text;
	}


function isEmailValid(email){
	return email.indexOf("@") > 0 && (email.indexOf("@") < email.lastIndexOf("."))
}



	function show(DIV, cTop, cLeft){
			//menu1.style.display = 'none';
			//menu2.style.display = 'none';
			//menu3.style.display = 'none';
			//menu4.style.display = 'none';
			//menu5.style.display = 'none';

		if (DIV != null){
//	alert('sss')
hideUserMenu()
				DIV.style.display = '';
		try{
				
				userMenuBackDIV.style.display = '';
		} catch(err){}
				
		}
		

	}
	
	function show2222(DIV){
		if (DIV != null){
			DIV.style.display = '';
		}
	}
	var disableAutoHide = false
	function tooltipPinEnable(DIV, DIVname){
		disableAutoHide=true;
		//log(disableAutoHide)
		closeButton = document.getElementById(DIVname + "CloseButton")
		closeButton.style.display = ""
	}
	function tooltipPinDisable(DIV, DIVname){
		disableAutoHide=false;
		//log(disableAutoHide)
		closeButton = document.getElementById(DIVname + "CloseButton")
		closeButton.style.display = "none"
	}
	
	function hide(DIV, DIVname){
			if (disableAutoHide){
		//if (DIVname == 'menuSend'){
				return false;
		//	}
		}
	
	//if (!e) var e = window.event;
//var tg = (window.event) ? e.srcElement : e.target;
///alert('leaving: '+ tg.tagName + ' ' + tg.id);
//if (tg.id == DIV){

	//alert('hiding')
		if (DIV != null){
			DIV.style.display = 'none';
		}
//	}
	}
	function hideUserMenu(){
		try{
			menu1.style.display = 'none';
		} catch(err){}
		try{
			userMenuMyStores.style.display = 'none';
		} catch(err){}
		try{
			userMenuBackDIV.style.display = 'none';
		} catch(err){}
		
		try{
			menuNotify.style.display = 'none';
		} catch(err){}
		try{
			menuSend.style.display = 'none';
		} catch(err){}
	}



function flashScrollTo(content, scrollSpeed){
	//productsListList.scrollTo(0, 50)

		switch (content){
			case "t": 
				contentDIV = toolbarContent
				contentDIVIn = toolbarContentIn
				scrollerTopDIV = toolbarScrollerTopDIV
				scrollerBottomDIV = toolbarScrollerBottomDIV
				break; 
			default: 
				contentDIV = productsListContent
				contentDIVIn = productsListContentIn
				scrollerTopDIV = productsListScrollerTopDIV
				scrollerBottomDIV = productsListScrollerBottomDIV
		}

	if (scrollSpeed != 0){
		contentDIV.scrollTop -= scrollSpeed;
	}
	if (contentDIV.scrollTop == 0){
		scrollerTopDIV.style.display = 'none'
	}else{
		scrollerTopDIV.style.display = ''
	}
	//log(contentDIV.scrollTop + " == (" + contentDIVIn.clientHeight + " - " + contentDIV.clientHeight + ") = " + (contentDIVIn.clientHeight - contentDIV.clientHeight) )
	
		//if (contentDIV.scrollTop >= contentDIVIn.clientHeight - contentDIV.clientHeight){
		if (contentDIV.scrollTop == contentDIVIn.clientHeight - contentDIV.clientHeight){
			scrollerBottomDIV.style.display = 'none'
		}else{
			scrollerBottomDIV.style.display = ''
		}	

}

function log(text){
	top.logTop(text)
}
var logLines = 0
function logTop(text){
	logLines++
	if (logLines > 30){
		logLines = 0
		logDIV.innerHTML = ""
	}
	logDIV.innerHTML = text + "<br>" + logDIV.innerHTML 
	//alert(text)
}


