﻿   	    
	    function clearDefault(el) 
	    {
	        if (el.defaultValue==el.value) el.value = ""
	    }
	    function findPos(obj) 
	    {
	        var curleft = curtop = 0;
	        if (obj.offsetParent) {
		        curleft = obj.offsetLeft
		        curtop = obj.offsetTop
		        while (obj = obj.offsetParent) {
			        curleft += obj.offsetLeft
			        curtop += obj.offsetTop
		        }
	        }
	        return [curleft,curtop];
        }
	
	
	
	
	
	

	
 function saveIt(name) {
	var x = document.forms['form1'].cookievalue.value;
	//var x = 1;
	if (!x)
		alert('Please fill in a value in the input box.');
	else {
		Cookies.create(name,x,7);
		alert('Cookie created');
	}
}

function readIt(name) {
	alert('The value of the cookie is ' + Cookies[name]);
}

function eraseIt(name) {
	Cookies.erase(name);
	alert('Cookie erased');
}

function init() {
	for (var i=1;i<3;i++) {
		var x = Cookies['ppkcookie' + i];
		if (x) alert('Cookie ppkcookie' + i + '\nthat you set on a previous visit, is still active.\nIts value is ' + x);
	}
}
	
var c=0
var t
var googlewin;

function timedCount()
{

divobj =  document.getElementById('chat');
c=c+1;
t=setTimeout("timedCount()",1000);
if(c==60)
{
    divobj =  document.getElementById('chat');
    var count = divobj.getElementsByTagName('img')
    if(count.length > 0)
    {
      
       str = new String(count[0].src)
      
       varpos = str.indexOf('DynamicsCenter_Chat_Available1.gif',0)
      
       if(varpos>0 )
            window.open("http://www.dynamicsexchange.com:4546/PureChat/PureChat.aspx","openmypage","width=455,height=365,location=0,menubar=0,resizable=0,scrollbars=0,status=1,titlebar=1,toolbar=0,scr eenX=10,left=10,screenY=10,top=10");

    }
     
   

}
}
function onLoodCookie()
{
  

}

function ShowFlash()
{
//alert("Flash");
var varpos;
      var divobj =  document.getElementById('chat');
    var count = divobj.getElementsByTagName('img')
    //alert(count);
    if(count.length > 0)
    {
        str = new String(count[0].src)
      //alert(str);
        varpos = str.indexOf('DynamicsCenter_Chat_Available.gif',0)
        //alert(varpos);
       if(varpos>0 )
       {
          // alert("in");
          document.getElementById("chat").style.display = "none";
       }
       else
       {
         //alert("out");
         document.getElementById("flash").style.display = "none";
         document.getElementById("chat").style.display = "block";
       }
    }
}

   
	 function Guidedpopup()
         {
            var w = 480, h = 340;

	        if (document.all) {
	            /* the following is only available after onLoad */
	            w = document.body.clientWidth;
	            h = document.body.clientHeight;
	        }
	        else if (document.layers) {
	            w = window.innerWidth;
	            h = window.innerHeight;
	        }

	        var popW = 525, popH = 480;

	        var leftPos = (w - popW) / 2, topPos = (h - popH) / 2;
	        //var leftPos = (725) / 2, topPos = (186) / 2;
            //googlewin = dhtmlwindow.open("dynamicsExchange", "iframe", "ceadvisor/TestDefault.aspx?CEID=cf2bd11c-572f-4448-894f-f2abfd4e8ef7", "Build Your CRM Solution", "width=757px,height=580px,resize=0,scrolling=0,center=0","recal");
            googlewin = dhtmlwindow.open("dynamicsExchange", "iframe", "SCDefault.aspx", "Build Your CRM Solution", "width=750px,height=580px,resize=0,scrolling=0,center=0","recal");
            googlewin.moveTo(370, 190);
         }



