﻿function GetDateFormat(date)
{
    var DateArray = date.split(" ");
    return ("<br /><b>" + DateArray[0] + "</b>");
}

function ShowNewToolTip()
{
    //Tip("New Template",PADDING, 5 ,BGCOLOR , "#009933" , FONTCOLOR , "#FFFFFF" , BORDERCOLOR , "#000000",  PADDING, 2 );//, FADEIN , 200 
    var str = '<table style="padding:5px; font-weight:bold; border: 1px solid black; color: black; font-family: arial; font-size: 11px; color:#FFFFFF"  bgcolor="#009933"  border="0" width="100%" cellspacing="0" cellpadding="0" ><tr><td>New Template</td></tr></table>';
    Tip(str, PADDING,"0" , BORDERSTYLE , 'none' );    
}

function ShowNeverSoldToolTip()
{
    //Tip("This template hasn\'t been sold till now!",PADDING, 5 ,BGCOLOR , "#0033FF" , FONTCOLOR , "#FFFFFF" , BORDERCOLOR , "#000000",  PADDING, 2);// , FADEIN , 200 
    var str = '<table style="padding:5px; font-weight:bold; border: 1px solid black; color: black; font-family: arial; font-size: 11px; color:#FFFFFF"  bgcolor="#0033FF"  border="0" width="100%" cellspacing="0" cellpadding="0" ><tr><td>This template hasn\'t been sold till now!</td></tr></table>';
    Tip(str, PADDING,"0" , BORDERSTYLE , 'none' );

}

function ShowFlashToolTip()
{
    var str = '<table style="padding:5px; font-weight:bold; border: 1px solid black; color: black; font-family: arial; font-size: 11px; color:#FFFFFF"  bgcolor="#ED1E1E"  border="0" width="100%" cellspacing="0" cellpadding="0" ><tr><td>This template has Flash Object!</td></tr></table>';
    Tip(str, PADDING,"0" , BORDERSTYLE , 'none' );
    //Tip("This template has Flash Object!",PADDING, 5 ,BGCOLOR , "#ED1E1E" , FONTCOLOR , "#FFFFFF" , BORDERCOLOR , "#000000",  PADDING, 2 );//
}

function ShowEnlarge()
{
    var str = '<table style="padding:5px; border: 1px solid black; color: black;"  bgcolor="#FFFFFF"  border="0" width="100%" cellspacing="0" cellpadding="0" ><tr><td width="37px" valign="middle" align="center"><span class="transp4"><img class="transp2" border="0" src="images/view-fullscreen.png"></span></td><td class="enlarge_text">&nbsp;Click on picture to see <span class="green_bold">enlarge picture</span>.</td></tr></table>';
    Tip(str, PADDING,"0" , BORDERSTYLE , 'none' );
}

function ShowInformation(str)
{
    //Tip(obj1,PADDING, 5 ,BGCOLOR , "#ED1E1E" , FONTCOLOR , "#FFFFFF" , BORDERCOLOR , "#000000",  PADDING, 2, STICKY , true);//FADEIN , 200 , 
    Tip(str, PADDING,"0" , BORDERSTYLE , 'none' ,STICKY , false);
}
function ShowInformation2(str)
{
    //Tip(obj1,PADDING, 5 ,BGCOLOR , "#ED1E1E" , FONTCOLOR , "#FFFFFF" , BORDERCOLOR , "#000000",  PADDING, 2, STICKY , false);//FADEIN , 200 , 
    Tip(str, PADDING,"0" , BORDERSTYLE , 'none' ,STICKY , false);
}
function ShowPageSelector(str)
{
    Tip(str, PADDING,"0" , BORDERSTYLE , 'none' ,STICKY , true,TITLE, "Page Selector",OFFSETY,-100,TITLEBGCOLOR,'#000000');
    
    //Tip(obj1,,  PADDING, 2 ,  STICKY , true,TITLE, "Page Selector",OFFSETY,-100);

}

function ShowEnlargePic(obj)
{
    try
    {
        var strFileName = "";
        var iPos = obj.src.lastIndexOf("/");
        var strFinalPath = "";
        strFileName = obj.src.substring(iPos+1 , obj.src.length);
        strFinalPath = "Preview.aspx?pic=" + strFileName;
        var winobj = window.open(strFinalPath ,'enlrg','toolbar=0,scrollbars=1,height=600');
	    if (winobj == null)
	    {
		    alert("Unable to open a new browser window,\n This might be due to a 'popup blocker'");
	    }
    }
    catch(Error)
    {
    }
}

function gotopage_dropdown(obj,currentpage_number,dest)
{

    var elem = document.getElementById(obj);
    var targetpage = elem.value;
    
    if(targetpage == currentpage_number)
    {
        alert('Selected page is current page!');
        return;
    }
    else
    {
        var csPath = dest + "?page=" + targetpage;
        window.location.href=csPath ;
    }
}

function gotopage(csTmp)
{
	var cspath = "gcorder.aspx?tpl=" + csTmp;
	window.location.href=cspath ;
}
function gotologoorderpage(csTmp)
{
	var cspath = "logoorder.aspx?logo=" + csTmp;
	window.location.href=cspath ;
}
  function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

  function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function getElementLeft(Elem)
{
		var elem;
		alert("1");
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		alert("2");
		    xPos = elem.offsetLeft;
		    tempEl = elem.offsetParent;
		alert("3");
  		while (tempEl != null) {
  			xPos += tempEl.offsetLeft;
	  		tempEl = tempEl.offsetParent;
  		}
  		alert("4");
		return xPos;
}


function getElementTop(Elem) {
		if(document.getElementById) {	
			var elem = document.getElementById(Elem);
		} else if (document.all) {
			var elem = document.all[Elem];
		}
		yPos = elem.offsetTop;
		tempEl = elem.offsetParent;
		while (tempEl != null) {
  			yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
  		}
		return yPos;
}

function preloader() 

{
    heavyImage = new Image(); 
    heavyImage.src = "/Images/progress_bar_3.gif";
}
function pausecomp(millis)
{
    var date = new Date();
    var curDate = null;

    do { curDate = new Date(); }
    while(curDate-date < millis);
} 
function fadeto100(IIII,IIIII,finalcss)
{


	   if(IIII==0){document.getElementById(IIIII).style.display = '';}	
	   if(IIII>4){document.getElementById(IIIII).className = finalcss;return;}
	   
	   
	   
	   
	   
	   switch(IIII)
	   {
	   case 0:document.getElementById(IIIII).className = finalcss + ' trans0';break;
	   case 1:document.getElementById(IIIII).className = finalcss + ' trans25';break;
	   case 2:document.getElementById(IIIII).className = finalcss + ' trans50';break;
	   case 3:document.getElementById(IIIII).className = finalcss + ' trans75';break;
	   case 4:document.getElementById(IIIII).className = finalcss + ' trans100';break;
	   }
	   IIII = IIII +1;

	   window.setTimeout ("fadeto100(" + IIII + ",'" + IIIII + "','" + finalcss + "');" , 40);
}
