function showpopwindow(filename,popW,popH)
{
	var w = 800, h = 600;
	if(typeof(popW) == "undefined")
	{
		popW=300;
	}
	if(typeof(popH) == "undefined")
	{
		popH=200;
	}
	/*
	if (document.all || document.layers)
	{
		w = screen.availWidth;
		h = screen.availHeight;
	}
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	window.open(filename,'popup','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos+',scrollbars=yes');
	*/
	var move = screen ? ',left='+((screen.width-popW)>>1)+',top='+((screen.height-popH)>>1) : '';
	//popupname = filename + "popup";
	//popupname = Math.random() + "popup";
	//var newwind = window.open(filename,popupname,'width=' + popW + ',height=' + popH + move +',scrollbars=yes');
	var newwind = window.open(filename,"",'width=' + popW + ',height=' + popH + move +',scrollbars=no');
	newwind.focus();
}

function showresizewindow(filename,popW,popH)
{
	var w = 800, h = 600;
	if(typeof(popW) == "undefined")
	{
		popW=300;
	}
	if(typeof(popH) == "undefined")
	{
		popH=200;
	}
	var move = screen ? ',left='+((screen.width-popW)>>1)+',top='+((screen.height-popH)>>1) : '';
	var newwind = window.open(filename,"",'width=' + popW + ',height=' + popH + move +',scrollbars=yes,resizable=yes');
	newwind.focus();
}

function showscrollablewindow(filename,popW,popH)
{
	var w = 800, h = 600;
	if(typeof(popW) == "undefined")
	{
		popW=300;
	}
	if(typeof(popH) == "undefined")
	{
		popH=200;
	}
	var move = screen ? ',left='+((screen.width-popW)>>1)+',top='+((screen.height-popH)>>1) : '';
	var newwind = window.open(filename,"",'width=' + popW + ',height=' + popH + move +',scrollbars=yes'+',resizable=no');
	newwind.focus();
}

function showfullwindow(filename)
{
	var newwind = window.open(filename,"",'scrollbars=yes,resizable=yes');
	newwind.focus();
}

function showcitylocation(country,state,city)
{
        var locationid,locid;
        var url;
        locationid = '::'+country+'::'+state+'::'+city;

        q = window.location.search;
        if(q.length > 1) this.q = q.substring(1, q.length);
        else this.q = null;
        this.keyValuePairs = new Array();
        this.keyPairs = new Array();
        if(q) {
        for(var i=0; i < this.q.split("&").length; i++) {
        this.keyValuePairs[i] = this.q.split("&")[i];

        }
        }

        var separator = '=';
        var searchid;
        searchid = 'loc_details';       ///  This search id needs to be modified
        var str;
        str="";

        for(var j=0; j < this.keyValuePairs.length; j++) {

        if(this.keyValuePairs[j].split(separator)[0] == searchid)
        {
        var stringArray = this.keyValuePairs[j].split(separator);

        for (var i=0; i < stringArray.length; i++){

                if(stringArray[i] == searchid){
                stringArray[i+1] = locationid;
                }

        }
        this.keyValuePairs[j] = stringArray[0] + "=" + stringArray[1];
        }


        }
        for (var i=0; i < keyValuePairs.length; i++){

        str = str + keyValuePairs[i];
        if(i < keyValuePairs.length-1) {  str = str + "&";}

        }

        //url = "http://"+(location.pathname)+"?"+str;

        ur=window.document.URL; 
	if(ur.indexOf('?')!=-1 && str.indexOf('loc_details')!=-1) {
         urls=ur.split('?');
 	 url = urls[0]+"?"+str;
         url=url.replace('ShowPublicPreview','ShowPublicView');
        } else if( ur.indexOf('?')!=-1 && str.indexOf('loc_details')==-1) {
         urls=ur.split('?');
 	 url = urls[0]+"?do=PublicView&submit=ShowPublicView&loc_details="+locationid;
         url=url.replace('ShowPublicPreview','ShowPublicView');
        }else {
         lpath= location.pathname;
	 lpath=lpath.replace('/','');
 	 url = (location.protocol)+"//"+(location.host)+"/Main.php"+"?do=PublicView&submit=ShowPublicView&loc_details="+locationid;
        }
        window.parent.location.href=url;


}

