﻿function trim(str)
{
	return str.replace(/^\s*|\s*$/g,"");
}


function g_e(el)
{
	return document.getElementById(el);
}

function p_date()
{
	var now = new Date();
	year = (now.getYear() > 1900) ? now.getYear() : now.getYear() + 1900;
	document.write(year);
}

function open_url(url)
{
    document.location.href = "http://" + document.location.hostname + url;
}

function proccess_ddm()
{
    if (obj = g_e("ddm"))
    {
        if (obj.value == 0)
            alert("Please select another category");
        else
            open_url(obj.value);
    }

    return false;
}

function gimg_open(url)
{
	window.open(url,'PhotoGallery','resizable=yes,toolbar=yes,scrollbars=yes,status=yes,location=0,width=540,height=500');
}

function wndSize()
{
	var winW = 0;

	if (document.body && document.body.offsetWidth) {
	 winW = document.body.offsetWidth;
	}

	if (document.compatMode=='CSS1Compat' &&
	    document.documentElement &&
	    document.documentElement.offsetWidth ) {
	 winW = document.documentElement.offsetWidth;
	}

	if (window.innerWidth) {
	 winW = window.innerWidth;
	}

	return winW;
}


if (wndSize() == 1024)
{
	var dsS = document.styleSheets;
	if (dsS[0].insertRule)
		dsS[0].insertRule("html { overflow-x: hidden; }", dsS[0].cssRules.length); // W3C DOM2 Style
	else if (dsS[0].addRule)
		dsS[0].addRule("html", "overflow-x: hidden"); // Microsoft
}

