﻿ 
var Previouslayer="layer1";
var adsno=1;

function show(lay,layNo)
{

	if (Previouslayer==lay)
	{
			document.getElementById(lay).style.display='block';
	}
	else
	{
		if (Previouslayer!="")
		{	document.getElementById(Previouslayer).style.display='none';
			document.getElementById(lay).style.display='block';
		}
	}
	Previouslayer=lay;
}


function ChangeLayerImage(Order)
{
	if (Order==1)
	{
		
		document.getElementById('m1').background="searchbox/img/Box_int_tab2.gif";
		document.getElementById('m2').background="searchbox/img/Box_int_tab4.gif";
	}
	else 
	{
		document.getElementById('m1').background="searchbox/img/Box_int_tab4.gif";
		document.getElementById('m2').background="searchbox/img/Box_int_tab2.gif";
	}


}

function ChangeStatusImage(Order)
{
	if (Order==1)
	{	
		document.getElementById('m1').style.backgroundImage="url(searchbox/img/Box_int_tab2.gif)";
		document.getElementById('m2').style.backgroundImage="url(searchbox/img/Box_int_tab4.gif)";
	}
	else
	{
		document.getElementById('m2').style.backgroundImage="url(searchbox/img/Box_int_tab2.gif)";
		document.getElementById('m1').style.backgroundImage="url(searchbox/img/Box_int_tab4.gif)";
	}
}

function ReturnImage(Order)
{
	if (Previouslayer=="layer1")
	{
		document.getElementById('m1').style.backgroundImage="url(searchbox/img/Box_int_tab2.gif)";
		document.getElementById('m2').style.backgroundImage="url(searchbox/img/Box_int_tab4.gif)";
	}
	else
	{
		document.getElementById('m1').style.backgroundImage="url(searchbox/img/Box_int_tab4.gif)";
		document.getElementById('m2').style.backgroundImage="url(searchbox/img/Box_int_tab2.gif)";
	}
}

function showPopup(url)
        { 
            newwindow=window.open(url,''); 
            if (window.focus)
            {
                newwindow.focus();
                newwindow.moveTo(0,0);
                newwindow.window.resizeTo(screen.availWidth,screen.availHeight);
                
            }
        } 
       

function showpop(type)
{
if(type=='up')
{
if(adsno==1)
{
var url='AdsDetails.aspx?AdsID=' + document.getElementById('ctl00_txtlnk1').value;

newwindow=window.open(url,'','scrollbars=no,height=400,width=500,top=300,left=300,resizable=no,'); 
            if (window.focus)
            {
                newwindow.focus();
            }
}

if(adsno==2)
{

var url='AdsDetails.aspx?AdsID=' + document.getElementById('ctl00_txtlnk2').value;
newwindow=window.open(url,'','scrollbars=no,height=400,width=500,top=300,left=300,resizable=no,'); 
            if (window.focus)
            {
                newwindow.focus();
            }
}

if(adsno==3)
{

var url='AdsDetails.aspx?AdsID=' + document.getElementById('ctl00_txtlnk3').value;

newwindow=window.open(url,'','scrollbars=no,height=400,width=500,top=300,left=300,resizable=no,'); 
            if (window.focus)
            { 
                newwindow.focus();
            }
}

}//if up
else
{

if(adsno==1)
{
var url='AdsDetails.aspx?AdsID=' + document.getElementById('ctl00_txtLeftLink1').value;

newwindow=window.open(url,'','scrollbars=no,height=400,width=500,top=300,left=300,resizable=no,'); 
            if (window.focus)
            {
                newwindow.focus();
            }
}

if(adsno==2)
{

var url='AdsDetails.aspx?AdsID=' + document.getElementById('ctl00_txtLeftLink2').value;
newwindow=window.open(url,'','scrollbars=no,height=400,width=500,top=300,left=300,resizable=no,'); 
            if (window.focus)
            {
                newwindow.focus();
            }
}

if(adsno==3)
{

var url='AdsDetails.aspx?AdsID=' + document.getElementById('ctl00_txtLeftLink3').value;

newwindow=window.open(url,'','scrollbars=no,height=400,width=500,top=300,left=300,resizable=no,'); 
            if (window.focus)
            { 
                newwindow.focus();
            }
}

}//else

}
function setLayer()
{
    var loct= window.location.toString();
    loct=loct.substring(loct.lastIndexOf('/')+1,loct.lastIndexOf('?'));
    if (loct=="ShowRoomSearch.aspx")
    {
        show("layer2","2");
        ChangeLayerImage("2");
        ChangeStatusImage("2");
    }
    
    
        

}
function st()
{

setLayer();
//window.alert(loct.match("aspx"));
document.getElementById('ctl00_txt1').style.display='none';
document.getElementById('ctl00_txt2').style.visibility="hidden";
document.getElementById('ctl00_txt3').style.visibility="hidden";
document.getElementById('ctl00_txt1').style.visibility="hidden";
document.getElementById('ctl00_txtlnk1').style.visibility="hidden";
document.getElementById('ctl00_txtlnk2').style.visibility="hidden";
document.getElementById('ctl00_txtlnk3').style.visibility="hidden";
document.getElementById('ctl00_txtLeft1').style.visibility="hidden";
document.getElementById('ctl00_txtLeft2').style.visibility="hidden";
document.getElementById('ctl00_txtLeft3').style.visibility="hidden";
document.getElementById('ctl00_txtLeftLink1').style.visibility="hidden";
document.getElementById('ctl00_txtLeftLink2').style.visibility="hidden";
document.getElementById('ctl00_txtLeftLink3').style.visibility="hidden";
show_first();
}
function show_first()
{
document.getElementById('img1').src =document.getElementById('ctl00_txt1').value;
document.getElementById('img2').src =document.getElementById('ctl00_txtLeft1').value;
adsno=1;

setTimeout("show_secound()",5000);
}

function show_secound()
{
document.getElementById('img1').src =document.getElementById('ctl00_txt2').value;
document.getElementById('img2').src =document.getElementById('ctl00_txtLeft2').value;
adsno=2;
setTimeout("show_third()",5000);
}

function show_third()
{
document.getElementById('img1').src =document.getElementById('ctl00_txt3').value;
document.getElementById('img2').src =document.getElementById('ctl00_txtLeft3').value;
adsno=3;
setTimeout("show_first()",5000);
}



function showImageWindow(imgsrc)
{
document.getElementById('tempimg').src=imgsrc;


win =window.open('img.html','myimg','scrollbars=no,width=300,height=225,top=300,left=300,resizable=no,toolbar=no,titlebar=no'); 
win.focus();
}


// for showroom pages use only
function showImageWindow1(imgsrc)
{
document.getElementById('tempimg').src=imgsrc;


win =window.open('../img.html','myimg','scrollbars=no,width=300,height=225,top=300,left=300,resizable=no,toolbar=no,titlebar=no'); 
win.focus();
}
