	var isDirty = "false";
	var flashPlayer ;
 
    function getFlashMovie(movieName) 
    {
        var isIE = navigator.appName.indexOf("Microsoft") != -1;
        return (isIE) ? window[movieName] : document[movieName];
    }

     function asResize()
     {
       getFlashMovie("DrawMain1").doResize();
     } 
     function viewableBox(type, userType) 
     {
 	    //http://bunnyherolabs.com/dhtml/browser-dimensions-table.html
       var w=document.body.clientWidth;
        var h=document.body.clientHeight;
        if(type=="w")
        {
            if(userType==0)
                return w-160 ;
            else
                return w ;
            
        }
        else
            return h ;
      
     }
     	
    function hideAds()
	{
		admodule.style.display='none'; 
	}
          
     function screenDim(type) 
     {
        if(type=="w")
            return screen.width ;
        else
            return screen.height ;
      
     }
	function exportfile(sUrl) 
	{ 
 
		var hf = document.getElementById('ifExport');
		//alert(sUrl);
		hf.src = sUrl;
	}
 
  window.onbeforeunload = confirmExit;
  function confirmExit()
  {
  	if(isDirty == "true")
		return "You have attempted to leave this page.  If you have made any changes to the diagram without clicking the Save button, your changes will be lost.  Are you sure you want to exit this page?";
  }
 
  
   function setDirty(flag)
   {
	isDirty = flag;
   }
function callLogOutAction(act) 
{
    setCookie("user_pwd","");
    window.location="http://www.drawanywhere.com/?" + act;
}
function GoToUpgrade(v) 
{
    window.location="http://www.drawanywhere.com/upgrade.aspx" + v;
}
function GoToSignup() 
{
    window.location="http://www.drawanywhere.com/signup.aspx" ;
}


function uploadAnImage(v, e) 
{
	//var q = args.substring(0, args.indexOf("|"));
	//alert("here");
	var surl = "./clientcall/ImgUpload.aspx?t=" + v + "&u=" + e;
	var winvars = "width=400,height=200,left=250,top=250,screenX=200,screenY=230";
	window.open(surl,'',winvars);
}
function exportPdf(v, e) 
{
	var surl = "/live/" + e + ".pdf?"+ v;
	window.open(surl,'','');
}
function exportSvg(v, e) 
{
	var surl = "/drawany/live/" + e + ".svg?utok="+ v;
	window.open(surl,'','');
}
function zzexportImg(v, e) 
{
	var surl = "/drawany/live/" + e + ".jpg?utok="+ v;
	window.open(surl,'','');
}
function completeImgUpload(id, name)  
{
       getFlashMovie("DrawMain1").loadNewImg(id, name);
}

function setCookie(name,value) {
	
		var date = new Date();
		date.setTime(date.getTime()+(180*24*60*60*1000)); //180 days
		var expires = "; expires="+date.toGMTString();
	    document.cookie = name+"="+value+expires+"; path=/";
}

function getCookie(name) {
	var name2 = name + "=";
	var cook_arry = document.cookie.split(';');
	for(var i=0;i < cook_arry.length;i++) {
		var c = cook_arry[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length); //trim left
		if (c.indexOf(name2) == 0) return c.substring(name2.length,c.length);
	}
	return "";
}
