﻿// JScript File
		function popModule(moduleParams){
			var arrayParams=moduleParams.split(",");
			var modName=arrayParams[0];
			var itemId=arrayParams[1];	
			var S=arrayParams[2];
			var G=0;
			if(arrayParams.length > 3)
			{
			    G = arrayParams[3];
			}
		    var intHeight = 0;
		    var intWidth = 0;
		    var strQstring = "";
		    var intModuleId = 0;
		    var intGo = 0;
		    var addationalParam = "";
		    if(arrayParams.length > 4)
		    {
		        addationalParam = "&" + arrayParams[4];
		    }
            if (S == "undefined")
		    {
		        S=0;
		    }
		    window.status='';
            var strUniqueCode = "";
            var strDate = new Date();
		    strUniqueCode = strDate.getMonth() + strDate.getDay() + strDate.getUTCFullYear() + strDate.getHours() + strDate.getMinutes() + strDate.getSeconds() + strDate.getMilliseconds() + Math.random();

		    switch(modName)
		    {
		        case "challenge":
		            intHeight = 768;
		            intWidth = 1024;
		            intModuleId = 1;
		            intGo = 1;
		            break;
		        case "envelop":
		            intHeight = 768;
		            intWidth = 1024;
		            intModuleId = 2;
		            intGo = 1;
		            break;
		        case "reward_products":
		            intHeight = 722;
		            intWidth = 1012;
		            intModuleId = 3;
		            intGo = 1;
		            break;
		        case "WishList":
		            intHeight = 722;
		            intWidth = 993;
		            intModuleId = 4;
		            intGo = 1;
		            break;
		        case "cards":
		            intHeight = 720;
		            intWidth = 993;
		            intModuleId = 5;
		            intGo = 1;
		            break;
		        case "blog":
		            intHeight = 733;
		            intWidth = 1024;
		            intModuleId = 6;
		            intGo = 1;
		            break;
		        case "register":
		            intHeight = 768;
		            intWidth = 1024;
		            intModuleId = 7;
		            intGo = 1;
		            break;
		        case "phone":
		            intHeight = 720;
		            intWidth = 993;
		            intModuleId = 8;
		            intGo = 1;
		            break;
                case "recent_challenge":
		            intHeight = 768;
		            intWidth = 1024;
		            intModuleId = 1;
		            intGo = 1;
		            break;
		        case "coffee":
		            intHeight = 720;
		            intWidth = 993;
		            intModuleId = 10;
		            intGo = 1;
		            break;
		        case "thermometer":
		            intHeight = 720;
		            intWidth = 993;
		            intModuleId = 11;
		            intGo = 1;
		            break;
		        case "privacy":
		            intHeight = 720;
		            intWidth = 990;
		            intModuleId = 12;
		            intGo = 1;
		            break;
		        case "search":
		            intHeight = 723;
		            intWidth = 994;
		            intModuleId = 13;
		            intGo = 1;
		            break;
		        case "eou":
		            intHeight = 720;
		            intWidth = 993;
		            intModuleId = 14;
		            intGo = 1;
		            break;
		        case "games":
		            intHeight = 720;
		            intWidth = 993;
		            intModuleId = 15;
		            intGo = 1;
		            break;
		        case "contest_products":
		            intHeight = 721;
		            intWidth = 1012;
		            intModuleId = 16;
		            intGo = 1;
		            break;
		        case "reading":
		            intHeight = 720;
		            intWidth = 993;
		            intModuleId = 17;
		            intGo = 1;
		            break;
		        case "video":
		            intHeight = 768;
		            intWidth = 1024;
		            intModuleId = 18;
		            intGo = 1;
		            break;
		        case "buycard":
		            intHeight = 768;
		            intWidth = 1024;
		            intModuleId = 19;
		            intGo = 1;
		            break;
				case "faq":
					intHeight = 760;
		            intWidth = 1024;
		            intModuleId = 20;
		            intGo = 1;
		    }
		    if(intGo == 1)
		    {
    		    strQstring = "mid=" + intModuleId + "&pkid=" + itemId + "&S=" + S + "&G=" + G + addationalParam + '&unqCode='+strUniqueCode;
    		   // alert(strQstring);
	    	    //tb_show(null,"http://192.168.91.42:9006/EditProfile.aspx?" + strQstring + "&KeepThis=true&TB_iframe=true&height=" + intHeight + "&width=" + intWidth,false);
	    	    tb_show(null,"http://localhost:2941/KDZLite/EditProfile.aspx?" + strQstring + "&KeepThis=true&TB_iframe=true&height=" + intHeight + "&width=" + intWidth,false);
	    	}
		}

    function getURL()
    {
        var url = window.location.href;
        var strLeft = "";
        var strRight = "";
        if(url.indexOf("?") > -1)
        {
            arrURL = url.split("?");
            url = arrURL[0];
        } // end if
        if(url.indexOf("://") > -1)
        {
            arrURL = url.split("://");
            strLeft = arrURL[0];
            strRight = arrURL[1];
            if(strRight.indexOf("/") > -1)
            {
                arrURL = strRight.split("/");
                strRight = arrURL[0];
            }
            url = strLeft + "://" + strRight + "/";
        }
        else
        {
            alert("Error in generating URL");
            url = "Error";
        }
        
        return url;
    } // end of function
    function setGuestDesktop(G,gname){
        //edited for calling flash function to refresh screen
        var myFlashMovie = getFlashMovieObject("MasterLayout");
	    /*if(navigator.appName.indexOf("Microsoft") != -1) {
		    var myFlashMovie = window.document["MasterLayout"];
		    } else {
		    var myFlashMovie =document["MasterLayout"];
		    }*/
	    if (typeof myFlashMovie != "undefined" && myFlashMovie != null)
        myFlashMovie.returnFunctionGuest(G,gname);
        KDZUserTracking.makeLogInKDZUserTracking(8,"My Network-Desktop Switchover?S="+G+"&gusetName="+gname);
    }
    function callBackFlash()
    {
    //edited for calling flash function to refresh screen
	    var myFlashMovie = getFlashMovieObject("MasterLayout");
	    /*if(navigator.appName.indexOf("Microsoft") != -1) {
	    var myFlashMovie = window["MasterLayout"];
	    } else {
	    var myFlashMovie = document["MasterLayout"];
	    }*/
	    if (typeof myFlashMovie != "undefined" && myFlashMovie != null)
	    myFlashMovie.returnFunction();
    }
    function getFlashMovieObject(movieName)
    {
        if (window.document[movieName]) 
        {
            return window.document[movieName];
        }
        if (navigator.appName.indexOf("Microsoft Internet")==-1)
        {
            if (document.embeds && document.embeds[movieName])
                return document.embeds[movieName]; 
        }
        else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
        {
            return document.getElementById(movieName);
        } 	
    }
     
    function openChallenge(challengeId,S,type){
        var strType = '';
        if(type == 'forsponsor'){
            strType = 'isfor=sponsorship';
        }
        else{
            strType = 'isfor=view';
        }
        popModule('challenge,'+challengeId+','+S + ',0,'+strType)
    }
function setChallengeTabs(tabLeft,tabRight,PF,EX,DD)
    {
        //alert('tabLeft-->' + tabLeft + ' tabRight-->' + tabRight + ' PF-->' + PF + ' EX-->' + EX + ' DD-->' + DD);
         //edited for calling flash function to refresh screen
        var myFlashMovie = getFlashMovieObject("MasterLayout");
	    /*if(navigator.appName.indexOf("Microsoft") != -1) {
		    var myFlashMovie = window.document["MasterLayout"];
		    } else {
		    var myFlashMovie =document["MasterLayout"];
		    }*/
	    if (typeof myFlashMovie != "undefined" && myFlashMovie != null)
			myFlashMovie.returnFunctionChallenge(tabLeft+"+"+tabRight,PF,EX,DD);
    }
function setBtabId(tabId)
{
	 //edited for calling flash function to refresh screen
	var myFlashMovie = getFlashMovieObject("MasterLayout");
	if (typeof myFlashMovie != "undefined" && myFlashMovie != null)
		myFlashMovie.returnFunctionBS(tabId);
}
function showFAQByModuleId(mid){
	popModule('faq,0,0,0,&helpMid='+mid);
}

