function split(){
        var splite = document.getElementById('clip').style.display = 'none';
	if (getCookie('countClip') < 7 )
	{
		// set to 7 so user will see click only three more times
	        document.cookie ='countClip=7;expires='+ myDate.toGMTString() + '; path=/';
	}else{ // if we are at 7 view at least, increment countClip by 1
		count = parseInt(getCookie('countClip')) + 1;
                document.cookie ='countClip='+count+';expires='+ myDate.toGMTString() + '; path=/';
	}
	//alert('Should be called ONCE during close of clip');		
}
function enda()
{
	//alert('This should apear ONLY at the end of second part of the clip');
	var splite = document.getElementById('clip').style.display = 'none';
	document.cookie ='countClip=10;expires='+ myDate.toGMTString() + '; path=/';
}

function clickClip()
{
        var countClick;var cook;
        if ( getCookie('cntClipClick' ) )
        {
                cook = parseInt(getCookie('cntClipClick'));
        }
        else{ cook = "0"; }

        countClick = parseInt(cook) + 1;
        document.cookie ='cntClipClick='+countClick+';expires='+ myDate.toGMTString() + '; path=/';
        document.getElementById('ButOpenClip').style.display='none';
        document.getElementById('clip').style.display='block';
}

function doClip()
{
	if ( getCookie('countClip') =="" ) 
		document.cookie ='countClip=0;expires='+ myDate.toGMTString() + '; path=/';
	//alert ( 'PRE: countClip:' +getCookie('countClip') + ' cntClipClick:' +getCookie('cntClipClick') );
	if ( getCookie('countClip') < 10 && getCookie('cntClipClick') < 3 )
	{
		if(document.body.offsetWidth >= 980)
		{
			document.getElementById('ButOpenClip').style.display='block';
			$("#clip").load("loadClip.html");
		}
		clip.style.right=(screen.width/2)-228;
		clip.style.top=242;
	        myDate = new Date ();
	        myDate.setFullYear(2999,01,01);
	        count = parseInt(getCookie('countClip')) + 1;
	        document.cookie ='countClip='+count+';expires='+ myDate.toGMTString() + '; path=/';
	}else{
	        document.getElementById('ButOpenClip').style.display='none';
	        // remove 3 lines before getting olnine
	        //alert ( 'count view:' +getCookie('countClip') + ' count click:' +getCookie('cntClipClick') );
	        //document.cookie ='countClip=0;expires='+ myDate.toGMTString() + '; path=/';
	        //document.cookie ='cntClipClick=0;expires='+ myDate.toGMTString() + '; path=/';
	}
}
