var practices = new Array();
practices['en'] = new Array(
    new Array(
        'Upcoming event',
        'Legal Seminar in November 2011 with the topic &bdquo;collection of outstanding payments in Germany&ldquo;',
        '<p>Legal Seminar in November 2011 with the topic &bdquo;collection of outstanding payments in Germany&ldquo;</p><p>Details will be published in August.</p>'
    ),
    new Array(
        'Real Estate Law',
        'Appel &amp; Partners has a diverse and expanding Real Estate practice',
        '<p>Appel &amp; Partners has a diverse and expanding Real Estate practice. Current clients range from multinational corporations and regional developers to local developers and individual investors.</p><p>Working closely with our Corporate, Tax, and Banking and Finance Practice Groups, our Real Estate Group provides complete, client-specific assistance of land for industrial use.</p>'
    ),
    new Array(
        'Banking and Finance',
        'The Banking Practice Group advises banks and other financial...',
        '<p>The Banking Practice Group advises banks and other financial institutions, corporate borrowers and lenders on all types of banking and financial transactions, including but not limited to: </p><p><ul><li>Commercial lending</li><li>Syndicated loans</li><li>Security arrangements</li><li>Trade financing</li><li>Banking due diligence and compliance</li></ul></p>'
    )
//    new Array(
//        'Intellectual Property',
//        'Appel &amp; Partners has an active practice in the areas of intellectual...',
//        '<p>Appel &amp; Partners has an active practice in the areas of intellectual property. Lawyers in the firm&#39;s Intellectual Property Group represent clients in all aspects of the creation, registration, licensing and protection of trademarks, patents, copyrights and other intellectual property rights. Our Intellectual Property Practice Group includes members of our litigation team who are experienced in infringement litigation relating to the ownership, licensing and use of intellectual property rights. Our intellectual property group also effects trademark and patent registrations throughout Southeast Asia and China.</p><p>The firm&#39;s Intellectual Property Group advises on overall corporate strategies necessary to address intellectual property concerns affecting its client&#39;s operations. The firm is actively engaged in intellectual property disputes on behalf of foreign and Taiwanese clients.</p>'
//    ),
//    new Array(
//        'Labour',
//        'Appel &amp; Partners structures, negotiates and drafts all types of...',
//        '<p>Appel &amp; Partners structures, negotiates and drafts all types of employment and labour contracts for both local and multinational corporations. Our labour practice provides services ranging from assistance on compliance with regulatory requirements to the structuring and establishment of benefit and compensation plans; they also render opinions in pensions, provident funds and assist with labour related business acquisition and reorganizations.</p><p>Our labour practice is experienced in the following areas: labour related immigration, employee share ownership, employment benefits, incentive structures, severance tax and regulatory matters. </p>'
//    ),
//    new Array(
//        'Capital Markets',
//        'Many of the firm&#39;s clients have sought financing in the public...',
//        '<p>Many of the firm&#39;s clients have sought financing in the public and private capital markets. Capital market transactions handled by the firm have included public offerings and private placements of common stock, securitizations and structured financing. The firm has represented Taiwanese and non-Taiwanese issuers seeking access to the Taiwanese and foreign capital markets.</p>'
//    ),
//    new Array(
//        'Tax',
//        'Appel &amp; Partners maintains a diversified tax practice, servicing...',
//        '<p>Appel &amp; Partners maintains a diversified tax practice, servicing multinational corporations, local public and private firms, finance companies and local individuals on a wide range of project. Our tax practice regularly advises on tax issues relating to foreign investment, along with suitable offshore structures for out bound transactions.</p><p> With broad experience, Appel &amp; Partners tax practice has established a reputation for innovative tax planning in Taiwan. Our tax practice is experienced in the following areas: transfer pricing, foreign investment, corporate tax, VAT issues, international tax treaties and joint venture taxation issues.</p>'
//    ),
//    new Array(
//        'Litigation and Arbitration',
//        'The firm has substantial experience in domestic and international...',
//        '<p>The firm has substantial experience in domestic and international arbitration. For disputes that cannot be settled by arbitration, the firm&#39;s attorneys are prepared to litigate in any forum. Appel &amp; Partners has been involved in actions such as prosecuting and defending clients in international arbitration procedures before the other international forums, such as the International Chamber of Commerce, and other international forums, as well as enforcement of arbitral awards in courts in and outside of Taiwan.</p><p>The firm has long standing experience in prosecuting and defending clients in civil litigation including tort claims, trade creditors&#39; claims, contractual disputes, bankruptcy reorganization, mergers and acquisition, insurance, maritime and aviation loss claims, claims based on breach of employment contracts, labor disputes, and prosecution and defense of white collar crimes. The firm&#39;s litigation practice includes an appellate practice.</p>'
//    ),
//    new Array(
//        'Technology',
//        'With their extensive experience in the fields of technology...',
//        '<p>With their extensive experience in the fields of technology and Communication, our lawyers advice providers and users on the drafting and implementation of the relevant contracts as well as on projects throughout the Asia-Pacific region.</p>'
//    )
);

practices['zh'] = new Array(
    new Array(
        '最新活動： 2011年11月',
        '法律研討會：追討在德國之未清賬款',
        '<p>法律研討會：追討在德國之未清賬款</p>'
    ),
    new Array(
        '合作',
        '合作法的核心是 Appel &amp; Partners 的做法，因為他包含的活動，',
        '<p>合作法的核心是 Appel &amp; Partners 的做法，因為他包含的活動，我們的不同做法的群體。該公司經常建議外部顧問的公司，提供諮詢公司，證卷，稅收和規管事宜在台灣。該公司客戶包含：航空，開發，投資營行，跨國公司，私人投資者，企業家，銀行和金融機構。</p><p>的經驗，律师的 Appel &amp; Partners 公司法组廣泛。他們定期提供法律服務在以下幾個方面:</p><p><ul><li>公司結構</li><li>外國投資</li><li>兼併和收購</li><li>合同的起草和解釋</li><li>尽职调查公开募股</li><li>法律審計和法規遵從</li><li>所得税和收入法</li><li>交易談判</li></ul></p><p>公司法集團一直參與了範圍廣泛的複雜公司法律問題，以及一般企業的法律問題所產生的日常。</p>'
    ),
    new Array(
        '資本市場',
        '許多公司的客戶尋求資金在公共和私人資本市場。',
        '<p>許多公司的客戶尋求資金在公共和私人資本市場。資本市場的交易處理公司包括公開發行和私募普通股股票，證卷化和結構化融資。該公司已經派代表台灣和非台灣發行尋求進入排灣和外國資本市場。</p>'
    )
//    new Array(
//        '銀行與金融',
//        '銀行業務組建議銀行和其他金融機構，企業借方和貸方...',
//        '<p>銀行業務組建議銀行和其他金融機構，企業借款人和貸款人對所有類型的銀行和金融交易，包括但不限于：</p><p><ul><li>商業貸款</li><li>銀團貸款</li><li>安全安排</li><li>貿易融資</li><li>銀行應有的注意和尊守</li></ul></p>'
//    )
);

practices['de'] = new Array(
    new Array(
        'Seminar November 2011',
        'Rechtliche Möglichkeiten der Ein&shy;treibung ausstehender Zahlungen in Deutschland.',
        '<p>Rechtliche Möglichkeiten der Eintreibung ausstehender Zahlungen in Deutschland.</p><p>Details werden im August veröffentlicht.</p>'
    ),
    new Array(
        'Immobilienrecht',
        'Appel &amp; Partners hat langjährige Erfahrungen im Immobilienrecht...',
        '<p>Appel &amp; Partners has a diverse and expanding Real Estate practice. Current clients range from multinational corporations and regional developers to local developers and individual investors.</p><p>Working closely with our Corporate, Tax, and Banking and Finance Practice Groups, our Real Estate Group provides complete, client-specific assistance of land for industrial use.</p>'
    ),
    new Array(
        'Banking und Finanzen',
        'Die Banking Practice Group berät Banken und andere Finanzinstitute...',
        '<p>The Banking Practice Group advises banks and other financial institutions, corporate borrowers and lenders on all types of banking and financial transactions, including but not limited to: </p><p><ul><li>Commercial lending</li><li>Syndicated loans</li><li>Security arrangements</li><li>Trade financing</li><li>Banking due diligence and compliance</li></ul></p>'
    )
//    new Array(
//        'Steuern',
//        'Appel &amp; Partners verfügt über umfangreiche Erfahrungen im...',
//        '<p>Appel &amp; Partners maintains a diversified tax practice, servicing multinational corporations, local public and private firms, finance companies and local individuals on a wide range of project. Our tax practice regularly advises on tax issues relating to foreign investment, along with suitable offshore structures for out bound transactions.</p><p> With broad experience, Appel &amp; Partners tax practice has established a reputation for innovative tax planning in Taiwan. Our tax practice is experienced in the following areas: transfer pricing, foreign investment, corporate tax, VAT issues, international tax treaties and joint venture taxation issues.</p>'
//    ),
//    new Array(
//        'Technologie',
//        'Mit ihrer großen Erfahrung in den Bereichen Technologie und...',
//        '<p>With their extensive experience in the fields of technology and Communication, our lawyers advice providers and users on the drafting and implementation of the relevant contracts as well as on projects throughout the Asia-Pacific region.</p>'
//    ),
//    new Array(
//        'Arbeitsrecht',
//        'Appel &amp; Partners strukturiert, verhandelt and entwirft alle...',
//        '<p>Appel &amp; Partners structures, negotiates and drafts all types of employment and labour contracts for both local and multinational corporations. Our labour practice provides services ranging from assistance on compliance with regulatory requirements to the structuring and establishment of benefit and compensation plans; they also render opinions in pensions, provident funds and assist with labour related business acquisition and reorganizations.</p><p>Our labour practice is experienced in the following areas: labour related immigration, employee share ownership, employment benefits, incentive structures, severance tax and regulatory matters. </p>'
//    )
);

var randomPractices;

function getRandomValues(max) {
    var abort = false;
    var rand;
    var randomValues = new Array();
    while (!abort && max > randomValues.length) {
        rand = Math.round(Math.random() * (max - 1));
        if (randomValues.indexOf(rand, 0) == -1) {
            randomValues.push(rand);
        }
        if (randomValues.length >= 3) {
            abort = true;
        }
    }

    return randomValues;
}

function createPractices(lang) {

    if(!Array.indexOf){
	    Array.prototype.indexOf = function(obj){
	        for(var i = 0; i < this.length; i++){
	            if(this[i] == obj){
	                return i;
	            }
	        }
	        return -1;
	    }
	}

    randomPractices = getRandomValues(practices[lang].length);

    for (var i = 0; i < randomPractices.length; i++) {

        var div = document.getElementById('practice' + i);

        var element = document.createElement('h2');
        div.appendChild(element);
        element.appendChild(document.createTextNode(practices[lang][randomPractices[i]][0]));

        element = document.createElement('p');
        div.appendChild(element);
        var moreText = 'more...';
        switch (lang) {
            case 'de':
                moreText = 'mehr';
                break;
            case 'zh':
                moreText = '更多';
                break;
            default:
                moreText = 'more';
        }
        var teaser = practices[lang][randomPractices[i]][1]
            + '<br/><a href="javascript:showPopup(\'practicePopup' + i + '\')">' + moreText + ' &raquo;</a>';
        element.innerHTML = teaser;

        // set the content for the popup
        var practicePopupContent = document.getElementById('practicePopup' + i).firstChild;
        var innerHtmlString = '<h1>' + practices[lang][randomPractices[i]][0] + '</h1>'
            + practices[lang][randomPractices[i]][2]
            + '<a href="javascript:hidePopup(\'practicePopup' + i + '\');" class="button_standard" style="margin:10px 0px; float:right;"></a>';
        practicePopupContent.innerHTML = innerHtmlString;
    }

}
