
//------------------------------------------------------------------//
//  Horizontal+Vertical Alignment to center                         //
//------------------------------------------------------------------//
function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
function setContentAlignToCenter(divID) 
{
	if (document.getElementById) 
	{
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentElement = document.getElementById(divID);
			var contentHeight = contentElement.offsetHeight;
			if (windowHeight - contentHeight > 0) {
				contentElement.style.position = 'relative';
				contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px';
			}
			else {
				contentElement.style.position = 'static';
			}
			//contentElement.style.visibility='visible';
		}
	}
}
























//-----------------------------------------------------------------//
//         Rad Window Manager                            //
//------------------------------------------------------------------//        
function showInfoWindow2(elementID)
{
    var oManager = GetRadWindowManager();
    var oWnd = oManager.GetWindowByName("DialogWindow");
    oWnd.Show();
    oWnd.setUrl("http://localhost/Yoyogam/preview_element.aspx?id="+elementID); 
    var oActive = oManager.GetActiveWindow();
}    



function showRadWindow(winUrl)
{
   //alert('2');
   var oWnd = oManager.GetWindowByName("DialogWindow");
   oWnd.SetUrl(winUrl);
   oWnd.Show(); 
   oWnd.setSize (788, 356);  
}       






      
        
        
        

//-----------------------------------------------------------------//
//         functions for replacing image source on item             //
//------------------------------------------------------------------//

function changeImage(imgSrc)
{
    document.getElementById("inkodhypera").src=imgSrc;
}
function changeImageByID(imgSrc,imgID)
{
    document.getElementById(imgID).src=imgSrc;
}   

//------------------------------------------------------------------//
//         functions for gallery thumbnails rollover effect         //
//------------------------------------------------------------------//
function changeGalleryImageByID(imgSrc,imgID,selectedButtonID)
{
    document.getElementById(imgID).src=imgSrc;
    document.getElementById(lastItemID).src='images/media_button_off.gif';
    lastItemID=selectedButtonID;
    document.getElementById(selectedButtonID).src='images/media_button_on.gif';
}

function changeGalleryButtonStateByID(imgSrc,imgID)
{
    document.getElementById(imgID).src=imgSrc;
}
function mouseover(ItemID) 
{ 
    window.document.getElementById( ItemID ).className = "ThumbDivOn";    
} 
function mouseout(ItemID) 
{ 
    window.document.getElementById( ItemID ).className = "ThumbDivOff";    
} 


//------------------------------------------------------------------//
//         functions for changing div element class                 //
//------------------------------------------------------------------//
function changeClassName(ItemID,NewClassName) 
{ 
    window.document.getElementById(ItemID).className = NewClassName;
} 



function chnageButtonImageSource(imgSrc,imgID)
{
    document.getElementById(imgID).src=imgSrc;
}



//------------------------------------------------------------------//
//         Catch Keydown                                            //
//------------------------------------------------------------------//
function catchKeyDown(btn, event)
{
    if (document.all)
    {
        if (event.keyCode == 13)
        {
             
             event.returnValue=false;
             event.cancel = true;
             document.getElementById(btn).click();
        }
   }
   else if (document.getElementById)
   {
        if (event.which == 13)
        {
            event.returnValue=false;
            event.cancel = true;
            document.getElementById(btn).click();
        }
   }
   else if(document.layers)
   {
        if(event.which == 13)
        {
            event.returnValue=false;
            event.cancel = true;
            document.getElementById(btn).click();
        }
    }
}


function clearField(elementID)
{
    document.getElementById(elementID).value="";
}
function resetFieldValue(elementID,originalValue)
{
    if(document.getElementById(elementID).value=="")
    {
        document.getElementById(elementID).value=originalValue;
    }
}


//function copyToClipboard(s)
//{
//	if( window.clipboardData && clipboardData.setData )
//	{
//		clipboardData.setData("Text", s);
//	}
//	else
//	{
//		// You have to sign the code to enable this or allow the action in about:config by changing
//		user_pref("signed.applets.codebase_principal_support", true);
//		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

//		var clip Components.classes['@mozilla.org/widget/clipboard;[[[[1]]]]'].createInstance(Components.interfaces.nsIClipboard);
//		if (!clip) return;

//		// create a transferable
//		var trans = Components.classes['@mozilla.org/widget/transferable;[[[[1]]]]'].createInstance(Components.interfaces.nsITransferable);
//		if (!trans) return;

//		// specify the data we wish to handle. Plaintext in this case.
//		trans.addDataFlavor('text/unicode');

//		// To get the data from the transferable we need two new objects
//		var str = new Object();
//		var len = new Object();

//		var str = Components.classes["@mozilla.org/supports-string;[[[[1]]]]"].createInstance(Components.interfaces.nsISupportsString);

//		var copytext=meintext;

//		str.data=copytext;

//		trans.setTransferData("text/unicode",str,copytext.length*[[[[2]]]]);

//		var clipid=Components.interfaces.nsIClipboard;

//		if (!clip) return false;

//		clip.setData(trans,null,clipid.kGlobalClipboard);	   
//	}
//}




