function makeSecureBaseUrl()
{
    var result = 'http://'+document.location.hostname;
    
    return result;
}
var requestWindow;
function openTimeChatRequest(expertId, profileId, chatType)
{
    if (document.location.protocol != 'https:')
    {
        requestWindow = window.open("../timechat/timechat.aspx?e="+ expertId+"&p="+profileId+"&t="+chatType, 'Chat','width=430,height=510');
    }
    else
    {
        requestWindow = window.open("../timechat/timechat.aspx?e="+ expertId+"&p="+profileId+"&t="+chatType, 'Chat','width=430,height=510');
    }
}
function poponclick(path)
{         
    testwindow= window.open ("../ExpertProfile/ExpertRatingDetail.aspx?RatingExpertID=" + path, 'mywindow','location=0,status=0,scrollbars=1,resizable=yes,width=500,height=500');
}  
function poponVideoConf(memberID)
{
    var popup_name = 'Video Chat';
    try
    {
        testwindow = window.open ("../videochat/chatrequest.aspx?expertid="+ memberID, 'Chat','width=1000,height=700');
        return false;
    }
    catch(ex)
    {}
}
function poponChat(expertId, clientId)
{    

    var popup_name = 'Text Chat';
    try
    {
        if (document.location.protocol != "https:")
        {
            testwindow = window.open(makeSecureBaseUrl()+'/chatwithexpert/chatpopup.aspx?expertid='+expertId+"&clientId="+clientId, 'Chat','width=960,height=600');
        }
        else
        {
            testwindow = window.open ("../ChatWithExpert/ChatPopup.aspx?expertID="+expertId+"&clientId="+clientId, 'Chat','width=960,height=600');
        }
        return false;
    }
    catch(ex)
    {}
                                   
}       
function poponGroupChat(memberID, imagePath)
{
    try
    {
        var win_name = 'Group Chat - ' + memberID;
        testwindow = window.open ("../ChatWithExpert/ChatClient.aspx?expertID=" + memberID+'&availableBal=900', 'Chat','location=0,status=0,scrollbars=0,width=750,height=570');//OpenPopup("../ChatWithExpert/ChatClient.aspx", 'Group Chat', 'location=0,status=0,scrollbars=0,width=750,height=570');
        testwindow.moveTo(300, 150);
        return false;
    }
    catch(ex){}
}
function poponChat1(memberID)
{
    testwindow= window.open ("../ChatWithExpert/ChatPopup.aspx?expertID=" + memberID, 'Chat','location=0,status=0,scrollbars=0,width=750,height=570');
    testwindow.moveTo(300,150);  
    return false;                                     
}
function OpenNewClientWindow(url, popupName, wt, ht)
{
window.size = ResizePopupWindow(wt, ht);
window.open(url,popupName);
}

function OpenPopup(url,popupName,wd,ht)
{
//var url = '../ChatWithExpert/ChatPopup.aspx?expertID=' + memberID;
var width=wd;
var height=ht;
var from_top=350;
var from_left=500;
var toolbar='no';
var location='no';
var directories='no';
var status='no';
var menubar='no';
var scrollbars='yes';
var resizable='yes';
var atts='width='+width+',height='+height+',top='+from_top+',screenY=';
atts+= from_top+',left='+from_left+',screenX='+from_left+',toolbar='+toolbar;
atts+=',location='+location+',directories='+directories+',status='+status;
atts+=',menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable;
window.open(url,popupName,atts);
return false;
}
function OpenTextPopup(url)
{
var from_top=350;
var from_left=500;
var toolbar='no';
var location='no';
var directories='no';
var status='no';
var menubar='no';
var scrollbars='yes';
var resizable='yes';
var atts='width=800,height=500';
window.open(url,'Text Chat',atts);
return false;
}
function OpenVideoPopup(url)
{
    var params = 'width=800,height=650';
    window.open(url,'Video Chat',params);
    return false;
}



function ResizePopupWindow(wt, ht)
{
	var w = wt;
	var h = ht;

	//IE
	if(!window.innerWidth)
	{
		//strict mode
		if(!(document.documentElement.clientWidth == 0))
		{
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		}
		//quirks mode
		else
		{
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
	}
	//w3c
	else
	{
		w = window.innerWidth;
		h = window.innerHeight;
	}
	return {width:w,height:h};
}